} $stm2->bind_param("sssssss", $email, $password, $fname, $lname, $last_ip, $priv, $sex); $stm2->execute(); $stm2->close(); // pull user ID for session data $uid = get_user_id($email); //// set session infos $_SESSION['signed_in'] = true; $_SESSION['fname'] = $fname; $_SESSION['email'] = $email; $_SESSION['user_id'] = $uid; $_SESSION['privleges'] = "user"; //$_SESSION['city'] = $city; //$_SESSION['state'] = $state; return true; } else { $_SESSION['signed_in'] = false; return false; } } //end main function! $ret = main_validation($email, $password1, $password2, $fname, $lname, $sex); // if we get a true, then everything went ok if ($ret == true) { $status = 1; } else { $status = 0; } $arr = array("status" => $status, "name" => $fname); $json = json_encode($arr); echo $json;
$_SESSION['privleges'] = $privleges; //$_SESSION['city'] = $city; //$_SESSION['state'] = $state; $arr = array("user_id" => $user_id, "name" => $first_name); return $arr; } else { $errors .= "password did not match our records"; $GLOBALS['errors'] = $errors; $_SESSION['signed_in'] = false; return array("user_id" => 0, "name" => "failure"); } } else { $errors .= "email was not found"; $GLOBALS['errors'] = $errors; $_SESSION['signed_in'] = false; return array("user_id" => 0, "name" => "failure"); } } //end main function! $email = $_REQUEST['user_email']; $pass = $_REQUEST['user_password']; $arr = main_validation($email, $pass); extract($arr); $errors = $GLOBALS['errors']; $status = 1; if (strlen($errors) > 1) { $status = 0; } $arr_to_encode = array("status" => $status, "message" => $errors, "name" => $name, "id" => $user_id); echo json_encode($arr_to_encode); // IF GOOD, START SESSION