code fro session expire

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
rrn
Forum Commoner
Posts: 46
Joined: Wed Apr 15, 2009 7:54 am

code fro session expire

Post by rrn »

i have got a login page with emAIL and password ..
can anyone suggest me a way to implement code for session to expire after 15 min when a peron is logged into the site if he is logged in for more than 15 min..

these are the two sessions in log in page .
$_SESSION['email']
$_SESSION['password']

below given is the code for log out page .

Code: Select all

<?php
 
session_start();
session_unregister('email');
session_unregister('password');
session_destroy();
?>
thank you... any help will be appreciated . . .
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Re: code fro session expire

Post by klevis miho »

pbs
Forum Contributor
Posts: 230
Joined: Fri Nov 07, 2008 5:31 am
Location: Nashik, India
Contact:

Re: code fro session expire

Post by pbs »

Use ini_set("session.gc_maxlifetime","900");
rrn
Forum Commoner
Posts: 46
Joined: Wed Apr 15, 2009 7:54 am

Re: code for session expire

Post by rrn »

what i want to do is , after logging in with username and password , user will be in a page ,, if he / she remains logged in for 15 min , i want it to be automatically logged out and come backk to main page ...

tried the above code , not working..
Post Reply