Hello!
To be able to pass sessions across domains, I use a link-based SID
ie: http://mysite.mysite.com/index.php?sid=af8dfs8gs99f
however I need to make it so that the session expires when they close their broswers - otherwise the session doesn't ever die and people could hack an acct.
Any ideas?
Sessions ?
Moderator: General Moderators
Use php's built in session support?
If you must make your own which is pretty pointless in my opinion (note i said opinion so dont criticise me) you can store the timestamp in the session and then compare the timestamp with the current time, if it is over a set amount of time make it expire, then every page view you could renew the timestamp in the session.. so if a user makes no page views for 5 minutes their session would expire or something like that... PHP's built in sessions expire automatically when the browser closes, you should check those out
<?
session_start();
$_SESSION['test']="hi";
print_r ($_SESSION);
?>
If you must make your own which is pretty pointless in my opinion (note i said opinion so dont criticise me) you can store the timestamp in the session and then compare the timestamp with the current time, if it is over a set amount of time make it expire, then every page view you could renew the timestamp in the session.. so if a user makes no page views for 5 minutes their session would expire or something like that... PHP's built in sessions expire automatically when the browser closes, you should check those out
<?
session_start();
$_SESSION['test']="hi";
print_r ($_SESSION);
?>