Session Time not updating

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
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Session Time not updating

Post by tecktalkcm0391 »

I have the following code, and it's not updating the session_time every time your refresh the page... its on required by header.php which is auto-appended.... i did an print_r and loggedin is there, but the time doesn't update

Code: Select all

if(isset($_SESSION['loggedin'])){
	if(isset($_SESSION['session_time'])){
		unset($_SESSION['session_time']);
		$_SESSION['session_time'] = time();	
	} else {
		$_SESSION['session_time'] = time();
	}
}
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

was session_start() called prior to this code running?
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

that was it! Thanks! I included the session.php page before that
Post Reply