Re: [PHP-DB] PHP Sessions
>>> "Ian McGhee" <[EMAIL PROTECTED]> 04/14/05 04:23AM >>> Hi All, I have been looking into PHP sessions and I have noticed you can actually use a database for storing the sessions instead of flat files I will be using MS SQL for the database can any one give be a clue as to how I would go about this or point me in the direction of a good tutorial? Start with the manual and read everything on Sessions. A search on google returns a few good examples. The second is very simple and anwers to the Database aspect http://www.oreilly.com/catalog/webdbapps/chapter/ch08.html http://www.comptechdoc.org/independent/web/php/intro/phpsessions.html Any Help would be greatly appreciated, Ian McGhee Email: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP Sessions
article on phpbuilder.com http://www.phpbuilder.com/columns/ying2602.php3?aid=19 bastien From: Maerlyn <[EMAIL PROTECTED]> To: php-db@lists.php.net Subject: Re: [PHP-DB] PHP Sessions Date: Thu, 14 Apr 2005 11:40:01 +0200 Hi, you might consider buying Peter Moulding's PHP Black Book. Among other things it tells much about DBs, sessions and storing sessions in databases. I already used it's codes, and I found it very useful. Maerlyn Ian McGhee wrote: > Hi All, > > > > I have been looking into PHP sessions and I have noticed you can > actually use a database for storing the sessions instead of flat > files I will be using MS SQL for the database can any one give be a > clue as to how I would go about this or point me in the direction > of a good tutorial? > > > > Any Help would be greatly appreciated, > > > > Ian McGhee > > > Email: [EMAIL PROTECTED] > > > > -- Maerlyn maerlyn[KUKAC]citromail[PONT]hu http://putraware.ini.hu GnuPG Public Key ID: 0x0CE0A57 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP Sessions
On Thursday 14 April 2005 10:23, Ian McGhee wrote: > I have been looking into PHP sessions and I have noticed you can > actually use a database for storing the sessions instead of flat files I > will be using MS SQL for the database can any one give be a clue as to > how I would go about this or point me in the direction of a good > tutorial? Have a look at the user comments on this page of the docs: http://www.php.net/manual/en/function.session-set-save-handler.php There are examples for MySQL and Postgres which should give you an idea of where to start. cheers Simon -- ~~ Simon Rees Â| [EMAIL PROTECTED] Â| ORA-03113: end-of-file on communication channel ~~ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP Sessions
i also want to buy this book. but could not find it in India. If anybody help me out. with best wishes balwant On Thu, 2005-04-14 at 15:10, Maerlyn wrote: > Hi, > > you might consider buying Peter Moulding's PHP Black Book. Among other > things it tells much about DBs, sessions and storing sessions in > databases. I already used it's codes, and I found it very useful. > > Maerlyn > > Ian McGhee wrote: > > > Hi All, > > > > > > > > I have been looking into PHP sessions and I have noticed you can > > actually use a database for storing the sessions instead of flat > > files I will be using MS SQL for the database can any one give be a > > clue as to how I would go about this or point me in the direction > > of a good tutorial? > > > > > > > > Any Help would be greatly appreciated, > > > > > > > > Ian McGhee > > > > > > Email: [EMAIL PROTECTED] > > > > > > > > > > > -- > Maerlyn > maerlyn[KUKAC]citromail[PONT]hu > http://putraware.ini.hu > GnuPG Public Key ID: 0x0CE0A57 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP Sessions
Hi, you might consider buying Peter Moulding's PHP Black Book. Among other things it tells much about DBs, sessions and storing sessions in databases. I already used it's codes, and I found it very useful. Maerlyn Ian McGhee wrote: > Hi All, > > > > I have been looking into PHP sessions and I have noticed you can > actually use a database for storing the sessions instead of flat > files I will be using MS SQL for the database can any one give be a > clue as to how I would go about this or point me in the direction > of a good tutorial? > > > > Any Help would be greatly appreciated, > > > > Ian McGhee > > > Email: [EMAIL PROTECTED] > > > > -- Maerlyn maerlyn[KUKAC]citromail[PONT]hu http://putraware.ini.hu GnuPG Public Key ID: 0x0CE0A57 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php sessions
you could put in a database an action field, and have a function check the action on every page. If the action says certain things, like KILL or REVALIDATE, then have it perform certain actions. For the first, I'd output an error page that says something like "Your session was killed by administrator (Admin ID)." Or, ask them for their password before carrying out their request for the latter example. there are several ways to do this. It all depends on what your server's capabilities and resources are (databases and such) and personal preference. HTH, -- The Disguised Jedi [EMAIL PROTECTED] Now you have my $0.02. Or .01 Pounds, .014 Euros, or $0.025 CAN. I'm already internationally compatible! PHP rocks! "Knowledge is Power. Power Corrupts. Go to school, become evil" Disclaimer: Any disclaimer attached to this message may be ignored. This message is Certified Virus Free -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] php sessions
The only way to be able to track user sessions would be to use a db, for the functionality that you want. Move your entire sessoion handling to the db (see here for an article on this:http://www.phpbuilder.com/columns/ying2602.php3?aid=19 ) You can track user ids, session ids, ip addresses etc with a table. Then its a simple matter to kill a user session by flagging or deleting the record. Sessions tracking and limiting can be done in two ways: 1. use a cookie and check for the existance of this cookie when the user attempts to log on 2. store the IP in a session variable Bastien From: "mel list_php" <[EMAIL PROTECTED]> To: php-db@lists.php.net Subject: [PHP-DB] php sessions Date: Tue, 15 Feb 2005 09:49:24 + Hi! I have a few questions about the sessions in php. I have a website where users are authentified through a login/password stored in a database. Once accepted, I start a session. - can I "disconnect" an user? I mean I have a logout script, which is called when the user wants to logout, but can I log him out myself? I was thinking deleting the session files in php/tmp, but I don't have this access (and don't think it is a good way). My second idea was logging myself as this user (as I know the login/pass), but will this end its session? I am not recoding the logout in the sql tables, so is there any way for me to kno which sessions are still active? - this lead to my second question, can I limit the number of session per user (to 1)? I think it is possible, because I saw on some websites the warning "only one active session allowed per user, if you are already logged in you will be disconnected" but I don't know how this is managed. - if my user is logged in (active session) and try to re-log in, will he open a new session or will he re-use the already opened one? I think the global idea behind all this is how to attach a session to an user and how to control it. Thanks for your help! _ Want to block unwanted pop-ups? Download the free MSN Toolbar now! http://toolbar.msn.co.uk/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] php sessions using mysql (or any db)
On Mon, 18 Nov 2002, Adam Nelson wrote: > One thing I left out - I had to take out the $GLOBALS[acdb] part from > mysql_query. This doesn't work with my version of php (4.2.3) I guess. > Also, assert(!empty($SessionTableName)); didn't work, so I commented it > out. Whoops, the $GLOBALS[acdb] was legacy code for the site I was using. Ignore it. Sorry! Your SessionTableName is set in php.ini -- if $sessiontablename is empty, there is an issue that will prevent sessions from being written/read from! Peter > > -Original Message- > > From: Peter Beckman [mailto:[EMAIL PROTECTED]] > > Sent: Monday, November 18, 2002 12:01 PM > > To: Adam Nelson > > Cc: [EMAIL PROTECTED]; 'Rasmus Lerdorf' > > Subject: RE: [PHP-DB] php sessions using mysql (or any db) > > > > > > >// This code is released under the same license as > > PHP. (http://www.php.net/license.html) > >assert(get_cfg_var("session.save_handler") == "user"); > >// Without save_handler being set to user, everything > > works fine until it calls the write handler. > >$SessionTableName = get_cfg_var("session.save_path"); > > // [$database.]tablename > >' > >function db_error_message() { > > return mysql_error(); > >} > >function mysql_session_open ($save_path, $session_name) { > >return true; > >} > >function mysql_session_close() { > >return true; > >} > >function mysql_session_read ($SessionID) { > >global $SessionTableName; > >$SessionID = addslashes($SessionID); > >$session_data = mysql_query("SELECT Data FROM > > $SessionTableName WHERE SessionID = '$SessionID'",$GLOBALS[acdb]) or > > die(db_error_mess > > age()); > >if (mysql_numrows($session_data) == 1) { > >return mysql_result($session_data, 0); > >} else { > >return false; > >} > >} > >function mysql_session_write ($SessionID, $val) { > >global $SessionTableName; > >$SessionID = addslashes($SessionID); > >$val = addslashes($val); > >$SessionExists = mysql_result(mysql_query("SELECT > > COUNT(*) FROM $SessionTableName WHERE SessionID = > > '$SessionID'",$GLOBALS[acdb]), > > 0 > > ); > >if ($SessionExists == 0) { > >$retval = mysql_query("INSERT INTO > > $SessionTableName (SessionID, LastActive, Data) VALUES ('$SessionID', > > > > UNIX_TIMESTAMP(NOW()),'$val')",$GLOBALS[acdb]) or > > die(db_error_message()); > >} else { > >$retval = mysql_query("UPDATE > > $SessionTableName SET Data = '$val', LastActive = > > UNIX_TIMESTAMP(NOW()) WHERE SessionID = > >'$SessionID'",$GLOBALS[acdb]) or > > die(db_error_message()); > >if (mysql_affected_rows() < 0) { > >error_log("unable to update session data > > for session $SessionID"); > >} > >} > >return $retval; > >} > >function mysql_session_destroy ($SessionID) { > >global $SessionTableName; > >$SessionID = addslashes($SessionID); > >$retval = mysql_query("DELETE FROM > > $SessionTableName WHERE SessionID = > > '$SessionID'",$GLOBALS[acdb]) or die(db_error_message()); > >return $retval; > >} > >function mysql_session_gc ($maxlifetime = 604800) { > >global $SessionTableName; > >$CutoffTime = time() - $maxlifetime; > >$retval = mysql_query("DELETE FROM > > $SessionTableName WHERE LastActive < > > $CutoffTime",$GLOBALS[acdb]) or die(db_error_message()); > >return $retval; > >} > >session_set_save_handler ( > >'mysql_session_open', > >'mysql_session_close', > >'mysql_session_read', > >'mysql_session_write', > >'mysql_session_destroy', > >'mysql_session_gc' > >); > > ?> > > On Mon, 18 Nov 2002, Adam Nelson wrote: > > > > > Thanks for th
RE: [PHP-DB] php sessions using mysql (or any db)
number 1 is perfect for one server number 2 (no jokes please) is great for multiple servers. What's neat is that you can use the format of number 1 with the mysql db in the back end quite simply. I could put the full code up with explanations, but here might not be the best place (It would take 2-3 pages). I think it should be in the documentation itself. I will write it up and send it to the appropriate parties and hopefully they will put it up. -Original Message- From: Adam Royle [mailto:[EMAIL PROTECTED]] Sent: Monday, November 18, 2002 5:12 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP-DB] php sessions using mysql (or any db) Hi, Just wondering, which is the better method: 1. Using PHP sessions ($_SESSION['var'] = "val";) 2. Using mySQL-based sessions (as described in this thread) I know if you're using multiple servers, a DB-based session would be handy. Any comments, anyone? Adam
RE: [PHP-DB] php sessions using mysql (or any db)
Hi, Just wondering, which is the better method: 1. Using PHP sessions ($_SESSION['var'] = "val";) 2. Using mySQL-based sessions (as described in this thread) I know if you're using multiple servers, a DB-based session would be handy. Any comments, anyone? Adam
RE: [PHP-DB] php sessions using mysql (or any db)
This works great :-) Thanks. I'll write a letter to onlamp.com to get that misleading code off their website (maybe it's PHP3 based?). Perhaps this should be added to PEAR? It appears that this is the proper repository for such things. I'll look into it although I would be much obliged if somebody in the know could handle this since I am new to PHP. One thing I left out - I had to take out the $GLOBALS[acdb] part from mysql_query. This doesn't work with my version of php (4.2.3) I guess. Also, assert(!empty($SessionTableName)); didn't work, so I commented it out. > -Original Message- > From: Peter Beckman [mailto:[EMAIL PROTECTED]] > Sent: Monday, November 18, 2002 12:01 PM > To: Adam Nelson > Cc: [EMAIL PROTECTED]; 'Rasmus Lerdorf' > Subject: RE: [PHP-DB] php sessions using mysql (or any db) > > > // This code is released under the same license as > PHP. (http://www.php.net/license.html) >assert(get_cfg_var("session.save_handler") == "user"); >// Without save_handler being set to user, everything > works fine until it calls the write handler. >$SessionTableName = get_cfg_var("session.save_path"); > // [$database.]tablename >' >function db_error_message() { > return mysql_error(); >} >function mysql_session_open ($save_path, $session_name) { >return true; >} >function mysql_session_close() { >return true; >} >function mysql_session_read ($SessionID) { >global $SessionTableName; >$SessionID = addslashes($SessionID); >$session_data = mysql_query("SELECT Data FROM > $SessionTableName WHERE SessionID = '$SessionID'",$GLOBALS[acdb]) or > die(db_error_mess > age()); >if (mysql_numrows($session_data) == 1) { >return mysql_result($session_data, 0); >} else { >return false; >} >} >function mysql_session_write ($SessionID, $val) { >global $SessionTableName; >$SessionID = addslashes($SessionID); >$val = addslashes($val); >$SessionExists = mysql_result(mysql_query("SELECT > COUNT(*) FROM $SessionTableName WHERE SessionID = > '$SessionID'",$GLOBALS[acdb]), > 0 > ); >if ($SessionExists == 0) { >$retval = mysql_query("INSERT INTO > $SessionTableName (SessionID, LastActive, Data) VALUES ('$SessionID', > > UNIX_TIMESTAMP(NOW()),'$val')",$GLOBALS[acdb]) or > die(db_error_message()); >} else { >$retval = mysql_query("UPDATE > $SessionTableName SET Data = '$val', LastActive = > UNIX_TIMESTAMP(NOW()) WHERE SessionID = >'$SessionID'",$GLOBALS[acdb]) or > die(db_error_message()); >if (mysql_affected_rows() < 0) { >error_log("unable to update session data > for session $SessionID"); >} >} >return $retval; >} >function mysql_session_destroy ($SessionID) { >global $SessionTableName; >$SessionID = addslashes($SessionID); >$retval = mysql_query("DELETE FROM > $SessionTableName WHERE SessionID = > '$SessionID'",$GLOBALS[acdb]) or die(db_error_message()); >return $retval; >} >function mysql_session_gc ($maxlifetime = 604800) { >global $SessionTableName; >$CutoffTime = time() - $maxlifetime; >$retval = mysql_query("DELETE FROM > $SessionTableName WHERE LastActive < > $CutoffTime",$GLOBALS[acdb]) or die(db_error_message()); >return $retval; >} >session_set_save_handler ( >'mysql_session_open', >'mysql_session_close', >'mysql_session_read', >'mysql_session_write', >'mysql_session_destroy', >'mysql_session_gc' >); > ?> > On Mon, 18 Nov 2002, Adam Nelson wrote: > > > Thanks for the clarification with the returns. I made the changes > > however and it still doesn't work. This code comes pretty > much straight > > off the presses from http://www.onlamp.com/lpt/a/832 > > > > What I have is quite modified from what is on there as it > is quite buggy > > to begin with. Anyway, It still doesn't
RE: [PHP-DB] php sessions using mysql (or any db)
http://www.php.net/license.html) assert(get_cfg_var("session.save_handler") == "user"); // Without save_handler being set to user, everything works fine until it calls the write handler. $SessionTableName = get_cfg_var("session.save_path"); // [$database.]tablename assert(!empty($SessionTableName)); function db_error_message() { return mysql_error(); } function mysql_session_open ($save_path, $session_name) { return true; } function mysql_session_close() { return true; } function mysql_session_read ($SessionID) { global $SessionTableName; $SessionID = addslashes($SessionID); $session_data = mysql_query("SELECT Data FROM $SessionTableName WHERE SessionID = '$SessionID'",$GLOBALS[acdb]) or die(db_error_mess age()); if (mysql_numrows($session_data) == 1) { return mysql_result($session_data, 0); } else { return false; } } function mysql_session_write ($SessionID, $val) { global $SessionTableName; $SessionID = addslashes($SessionID); $val = addslashes($val); $SessionExists = mysql_result(mysql_query("SELECT COUNT(*) FROM $SessionTableName WHERE SessionID = '$SessionID'",$GLOBALS[acdb]), 0 ); if ($SessionExists == 0) { $retval = mysql_query("INSERT INTO $SessionTableName (SessionID, LastActive, Data) VALUES ('$SessionID', UNIX_TIMESTAMP(NOW()),'$val')",$GLOBALS[acdb]) or die(db_error_message()); } else { $retval = mysql_query("UPDATE $SessionTableName SET Data = '$val', LastActive = UNIX_TIMESTAMP(NOW()) WHERE SessionID = '$SessionID'",$GLOBALS[acdb]) or die(db_error_message()); if (mysql_affected_rows() < 0) { error_log("unable to update session data for session $SessionID"); } } return $retval; } function mysql_session_destroy ($SessionID) { global $SessionTableName; $SessionID = addslashes($SessionID); $retval = mysql_query("DELETE FROM $SessionTableName WHERE SessionID = '$SessionID'",$GLOBALS[acdb]) or die(db_error_message()); return $retval; } function mysql_session_gc ($maxlifetime = 604800) { global $SessionTableName; $CutoffTime = time() - $maxlifetime; $retval = mysql_query("DELETE FROM $SessionTableName WHERE LastActive < $CutoffTime",$GLOBALS[acdb]) or die(db_error_message()); return $retval; } session_set_save_handler ( 'mysql_session_open', 'mysql_session_close', 'mysql_session_read', 'mysql_session_write', 'mysql_session_destroy', 'mysql_session_gc' ); ?> On Mon, 18 Nov 2002, Adam Nelson wrote: > Thanks for the clarification with the returns. I made the changes > however and it still doesn't work. This code comes pretty much straight > off the presses from http://www.onlamp.com/lpt/a/832 > > What I have is quite modified from what is on there as it is quite buggy > to begin with. Anyway, It still doesn't work. In perl, this would have > been done already. I can't be the first person to try running sessions > on a database. Does anyone have a session.inc file that would be > appropriate for me. I feel like it should just be in the php base > files. > > > > -Original Message- > > From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] > > Sent: Friday, November 15, 2002 4:59 PM > > To: Adam Nelson > > Cc: [EMAIL PROTECTED] > > Subject: Re: [PHP-DB] php sessions using mysql (or any db) > > > > > > > CREATE TABLE `SessionsTable` ( > > > `SID` varchar(32) NOT NULL default '', > > > > This doesn't need to be a varchar. The sid will always be 32 > > chars, so > > make it a char(32) > > > > This is just an artifact of InnoDB/Mysql. I don't know the specifics, > but I think char is no longer used by InnoDB (ie. it is just an alias > for varchar). Anyway, I put in char, the ddl pops out as varchar. > > > > `expiration` int(11) NOT NULL default '0', > > > > I would suggest using a "timestamp" type here so MySQL will handle > > updating it for you automatically. > > timestamp would change with every update. This is a field to describe > when the record should expire > &
RE: [PHP-DB] php sessions using mysql (or any db)
Thanks for the clarification with the returns. I made the changes however and it still doesn't work. This code comes pretty much straight off the presses from http://www.onlamp.com/lpt/a/832 What I have is quite modified from what is on there as it is quite buggy to begin with. Anyway, It still doesn't work. In perl, this would have been done already. I can't be the first person to try running sessions on a database. Does anyone have a session.inc file that would be appropriate for me. I feel like it should just be in the php base files. > -Original Message- > From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] > Sent: Friday, November 15, 2002 4:59 PM > To: Adam Nelson > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] php sessions using mysql (or any db) > > > > CREATE TABLE `SessionsTable` ( > > `SID` varchar(32) NOT NULL default '', > > This doesn't need to be a varchar. The sid will always be 32 > chars, so > make it a char(32) > This is just an artifact of InnoDB/Mysql. I don't know the specifics, but I think char is no longer used by InnoDB (ie. it is just an alias for varchar). Anyway, I put in char, the ddl pops out as varchar. > > `expiration` int(11) NOT NULL default '0', > > I would suggest using a "timestamp" type here so MySQL will handle > updating it for you automatically. timestamp would change with every update. This is a field to describe when the record should expire > > > function mysql_session_open($session_path, $session_name) { > > > > mysql_pconnect("localhost", "root", "") > > or die("Can't connect to MySQL server! "); > > > > mysql_select_db("globalDB") > > or die("Can't select MySQL sessions database"); > > > > } // end mysql_session_open() > > You need to return true; at the end of this. > true. > > function mysql_session_close() { > > > > return 1; > > No, use return true; > > > function mysql_session_select($SID) { > > > > GLOBAL $sess_db; > > GLOBAL $sess_table; > > > > $query = "SELECT value FROM $sess_table > > WHERE SID = '$SID' AND > > expiration > ". time(); > > > > $result = mysql_query($query); > > > > } // end mysql_session_select() > > Uh, you need to return the actual value here or an empty string on an > error. > > > function mysql_session_write($SID,$value) { > > > > GLOBAL $sess_db; > > GLOBAL $sess_table; > > GLOBAL $lifetime; > > > > $expiration = time() + $lifetime; > > > > $query = "INSERT INTO $sess_table > > VALUES('$SID', '$expiration', '$value')"; > > > > $result = mysql_query($query); > > > > if (! $result) : > > > >$query = "UPDATE $sess_table SET > >expiration = '$expiration', > >value = '$value' WHERE > >SID = '$SID' AND expiration >". time(); > >$result = mysql_query($query); > > > > endif; > > > > } // end mysql_session_write() > > Again, you *must* return true; on a sucessful write. > > > function mysql_session_destroy($sessionID) { > > > > GLOBAL $sess_table; > > > > $query = "DELETE FROM $sess_table > > WHERE SID = '$sessionID'"; > > $result = mysql_query($query); > > > > } // end mysql_session_destroy() > > return true; > > -Rasmus > > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php sessions using mysql (or any db)
> CREATE TABLE `SessionsTable` ( > `SID` varchar(32) NOT NULL default '', This doesn't need to be a varchar. The sid will always be 32 chars, so make it a char(32) > `expiration` int(11) NOT NULL default '0', I would suggest using a "timestamp" type here so MySQL will handle updating it for you automatically. > function mysql_session_open($session_path, $session_name) { > > mysql_pconnect("localhost", "root", "") > or die("Can't connect to MySQL server! "); > > mysql_select_db("globalDB") > or die("Can't select MySQL sessions database"); > > } // end mysql_session_open() You need to return true; at the end of this. > function mysql_session_close() { > > return 1; No, use return true; > function mysql_session_select($SID) { > > GLOBAL $sess_db; > GLOBAL $sess_table; > > $query = "SELECT value FROM $sess_table > WHERE SID = '$SID' AND > expiration > ". time(); > > $result = mysql_query($query); > > } // end mysql_session_select() Uh, you need to return the actual value here or an empty string on an error. > function mysql_session_write($SID,$value) { > > GLOBAL $sess_db; > GLOBAL $sess_table; > GLOBAL $lifetime; > > $expiration = time() + $lifetime; > > $query = "INSERT INTO $sess_table > VALUES('$SID', '$expiration', '$value')"; > > $result = mysql_query($query); > > if (! $result) : > >$query = "UPDATE $sess_table SET >expiration = '$expiration', >value = '$value' WHERE >SID = '$SID' AND expiration >". time(); >$result = mysql_query($query); > > endif; > > } // end mysql_session_write() Again, you *must* return true; on a sucessful write. > function mysql_session_destroy($sessionID) { > > GLOBAL $sess_table; > > $query = "DELETE FROM $sess_table > WHERE SID = '$sessionID'"; > $result = mysql_query($query); > > } // end mysql_session_destroy() return true; -Rasmus -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php