Ben bir giriş sistemi kullanıyorum, ve ben onlar özellikle oturumu sürece 10 gün boyunca oturum açmış kullanıcıyı tutmaya çalışıyorum. Ben kullanıcı kalmak için 10 gün içinde giriş yapacak session_set_cookie_params('864000'); o kullanarak düşündüm. Ama en azından Chrome, o yapmıyor. Kullanıcı sadece otomatik olarak kesilmeden önce standart 20-30 dakika boyunca giriş yapmalısınız görünüyor. Ben Chrome'da çerezleri kontrol ettiğimiz zaman, sona erme ile benim URL için listelenen iki PHP Oturum çerezleri, geleceğe 10 gün Tarihleri vardır. Ama bu giriş değişkenleri ilgisiz gibi görünüyor. Ilgili kod çoğu altında olmalıdır.
Kullanıcı 10 gün boyunca oturum değil Herhangi bir fikir neden?
Teşekkür peşin,
John
Indeks dosyasında, ben şu var:
require_once "header.php";
//content
include "login.php";
Header.php dosyasında, şu yer almaktadır:
session_set_cookie_params('864000');
session_start();
Login.php dosyasında, şu yer almaktadır:
if (checkLogin($_POST['username'], $_POST['password']))
{
show_userbox();
}
Burada fonksiyonu "checkLogin" dir:
function checkLogin($u, $p)
{
global $seed; // global because $seed is declared in the header.php file
if (!valid_username($u) || !valid_password($p) || !user_exists($u))
{
return false; // the name was not valid, or the password, or the username did not exist
}
//Now let us look for the user in the database.
$query = sprintf("
SELECT loginid
FROM login
WHERE
username = '%s' AND password = '%s'
AND disabled = 0 AND activated = 1
LIMIT 1;", mysql_real_escape_string($u), mysql_real_escape_string(sha1($p . $seed)));
$result = mysql_query($query);
// If the database returns a 0 as result we know the login information is incorrect.
// If the database returns a 1 as result we know the login was correct and we proceed.
// If the database returns a result > 1 there are multple users
// with the same username and password, so the login will fail.
if (mysql_num_rows($result) != 1)
{
return false;
} else
{
// Login was successfull
$row = mysql_fetch_array($result);
// Save the user ID for use later
$_SESSION['loginid'] = $row['loginid'];
// Save the username for use later
$_SESSION['username'] = $u;
// Now we show the userbox
return true;
}
return false;
}