本文整理匯總了PHP中session::Save方法的典型用法代碼示例。如果您正苦於以下問題:PHP session::Save方法的具體用法?PHP session::Save怎麽用?PHP session::Save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類session
的用法示例。
在下文中一共展示了session::Save方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: footer
public static function footer()
{
$current_user =& singleton("current_user");
include_template(ALLOC_MOD_DIR . "shared/templates/footerS.tpl");
// close page
$sess = new session();
$sess->Save();
if (is_object($current_user) && method_exists($current_user, "get_id") && $current_user->get_id()) {
$current_user->store_prefs();
}
}
示例2: get_current_user
private function get_current_user($sessID)
{
$sess = new session($sessID);
if ($sess->Started()) {
$person = new person();
$person->load_current_user($sess->Get("personID"));
// update session_started, which affects session lifetime
$sess->Save();
return $person;
}
}
示例3: person
} else {
if ($_POST["login"]) {
$person = new person();
$row = $person->get_valid_login_row($_POST["username"], $_POST["password"]);
if ($row) {
$sess->Start($row);
$q = prepare("UPDATE person SET lastLoginDate = '%s' WHERE personID = %d", date("Y-m-d H:i:s"), $row["personID"]);
$db = new db_alloc();
$db->query($q);
if ($sess->TestCookie()) {
$sess->UseCookie();
$sess->SetTestCookie($_POST["username"]);
} else {
$sess->UseGet();
}
$sess->Save();
alloc_redirect($url);
}
$error = "Invalid username or password.";
} else {
if ($_POST["new_pass"]) {
$db = new db_alloc();
$db->query("SELECT * FROM person WHERE emailAddress = '%s'", $_POST["email"]);
if ($db->next_record()) {
// generate new random password
$password = "";
$pwSource = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!?";
srand((double) microtime() * 1000000);
for ($i = 0; $i < 8; $i++) {
$password .= substr($pwSource, rand(0, strlen($pwSource)), 1);
}