Re: sessions in database
or $result = eval(return \$_SESSION;); pr($result); On Apr 4, 11:49 am, jyrgen [EMAIL PROTECTED] wrote: here's a solution i found on php.net. it's definitely not smart, but works ok. $temp = mysql_query('SELECT * FROM sessions'); while ($row = mysql_fetch_array($temp)){ $variables = array( ); $a = preg_split( /(\w+)\|/, $row['data'], -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE ); for( $i = 0; $i count( $a ); $i = $i+2 ) { $variables[$a[$i]] = unserialize( $a[$i+1] ); } } pr($variables); cheers, jyrgen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
sessions in database
howdy, how do you check if a user with a particular id is already logged in ? it is that i want to prevent people from loggin in twice. of course i could search the sessions table, but i'm stuck with the fact that all session vars are serialized. has anybody come across this ? thanks for your help jyrgen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: sessions in database
here's a solution i found on php.net. it's definitely not smart, but works ok. $temp = mysql_query('SELECT * FROM sessions'); while ($row = mysql_fetch_array($temp)){ $variables = array( ); $a = preg_split( /(\w+)\|/, $row['data'], -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE ); for( $i = 0; $i count( $a ); $i = $i+2 ) { $variables[$a[$i]] = unserialize( $a[$i+1] ); } } pr($variables); cheers, jyrgen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: sessions in database
There is $db-value(time()) wich fetch value from data field in session table... from libs/session.php: $db = ConnectionManager::getDataSource('default'); $table = $db-fullTableName(CAKE_SESSION_TABLE); $db-execute(DELETE FROM . $db-name($table) . WHERE . $db- name($table.'.expires') . . $db-value(time())); Can U use this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: sessions in database
Hi Majna, it's not that i want to check for expiration, but rather if a user is already logged in. (see above) i cannot simply test for sth. like $this-Session-read('logged_in') because this refers to the current session, which i am just about to construct... therefore i had to search all existing session entries in the db for a userID and the logged_in flag. the code i posted is ugly, i looked at /lib/session.php twice but i was not able to determine how cake unserializes the session vars. still i'm looking for a better solution. regards, jyrgen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---