Sessions ?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
zatch
Forum Newbie
Posts: 18
Joined: Fri Jul 02, 2004 7:05 pm

Sessions ?

Post by zatch »

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?
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

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);
?>
Post Reply