Sesson handling with cookie
| From: | Bolla Sándor | Date: | Wed, 22 Dec 2004 13:31:10 +0000 |
| Subject: | Sesson handling with cookie | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-204951@lists.php.net to get a copy of this message | ||
Hi,
PHP 4.2.2, MySQL 3.23.xx
I have a problem destorying the actual session_id (SID)?
I tried to use session_destroy(), session_unset, but nothing works, session_id() is always the same.
What I want to do is:
- After 30 Minutes if the user didn't do any work then let the session die
- It must be work wheter browser's cookie is set or not?
What Should I do to let it work?
I successfully check if 30 minutes left after last (site)change, but I can't give a new Session_id(), after I let the user redirect onto the login page?
Bye
Alex
Background:
- I save the login information into database with the following columns:
CREATE TABLE
LOGIN (
MKMKOD varchar(20) NOT NULL default '',
SESSION varchar(255) NOT NULL default '',
LOGIN_TIME datetime NOT NULL default '0000-00-00 00:00:00',
HOST varchar(15) NOT NULL default '',
CURRENT_STATE varchar(255) default ''
) TYPE=MyISAM;
- I check if it's over 30 minutes, on the current request:
'SELECT * FROM LOGIN WHERE MKMKOD = "'.$_mkmkod_.'" AND (DATE_SUB(NOW(),INTERVAL 30 MINUTE) <= LOGIN_TIME) AND HOST = "'.$_SERVER['REMOTE_ADDR'].'"'