I want my cookie not to be reset when i close the browser. The way i have it right now it expires whenever i close the browser... I REALLY REALLY need a solution to this so please if someone could give me some time id REALLY appriciate it!! I dont know how to set it this way.... i want it to expire like a week after you login not very time you close the browser. Im doing this because im an iPhone developer and i have a web app that uses this but i dont want my customers to have to login every time they open the app! Theyv been complaining about it and i need to fix it.
This is my login.php file
<?php
/**
* login.php
*
* @version 1.0
* @copyright 2008 by ?????? for
XNova
*/
define('INSIDE' , true);
define('INSTALL' , false);
$InLogin = true;
$ugamela_root_path = './';
include($ugamela_root_path . 'extension.inc');
include
($ugamela_root_path . 'common.' . $phpEx);
includeLang('login');
if ($_POST)
{
$login = doquery("SELECT * FROM {{table}} WHERE
`username` = '" . mysql_escape_string($_POST['username']) . "' LIMIT 1",
"users", true);
if ($login) {
if ($login
['password'] == md5($_POST['password'])) {
if
(isset($_POST["rememberme"])) {
}
@include('config.php');
$cookie = $login["id"]
. "/%/" . $login["username"] . "/%/" . md5($login["password"] . "--" . $dbsettings
["secretword"]) . "/%/" . $rememberme;
setcookie($game_config['COOKIE_NAME'], $cookie, $expiretime, "/", "", 0);
unset($dbsettings);
if ($login
['urlaubs_modus'] == 1) {
$time_out =
((($login['urlaubs_modus_time'] + VOCATION_TIME)-time())/3600);
if (time() >= $login['urlaubs_modus_time'] + VOCATION_TIME ){
header("Location:
./options.php");
exit;
} else {
message($lang['vacation_mode'].floor($time_out).$lang['hours'], $lang['vacations']);
}
} else {
header("Location: ./overview.php");
}
exit;
} else {
message($lang['Login_FailPassword'], $lang['Login_Error']);
}
} else {
message($lang
['Login_FailUser'], $lang['Login_Error']);
}
} elseif(!empty
($_COOKIE[$game_config['COOKIE_NAME']])) {
$cookie = explode
('/%/',$_COOKIE[$game_config['COOKIE_NAME']]);
$login =
doquery("SELECT * FROM {{table}} WHERE `username` = '" .
mysql_escape_string($cookie[1]) . "' LIMIT 1", "users", true);
if
($login) {
@include('config.php');
if
(md5($login["password"] . "--" . $dbsettings["secretword"]) == $cookie[2]) {
unset($dbsettings);
header
("Location: ./overview.php");
exit;
}
}
}
$parse = $lang;
$query = doquery('SELECT username FROM {{table}} ORDER BY
register_time DESC', 'users', true);
$parse['last_user'] = $query
['username'];
$query = doquery("SELECT COUNT(DISTINCT(id))
FROM {{table}} WHERE onlinetime>" . (time()-900), 'users', true);
$parse['online_users'] = $query[0];
$parse['users_amount'] =
$game_config['users_amount'];
$parse['servername'] =
$game_config['game_name'];
$parse['forum_url'] = $game_config
['forum_url'];
$parse['PasswordLost'] = $lang['PasswordLost'];
$page = parsetemplate(gettemplate('login_body'), $parse);
display
($page, $lang['Login']);
// ----------------------------------------------------------------------------------------------------
-------
// History version
?>