hey,
session data are serialized. i failed with php command
"unserialize", because of the "|" signs, which apparently
separate subarrays.
i found no other way of getting the data out of the session.
see this example:
$account_in_use = false;
$temp = mysql_query('SELECT * FROM sessions');
while($row = mysql_fetch_array($temp)){
$vars = 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){
$vars[$a[$i]] = unserialize($a[$i+1]);
}
if(isset($vars['User']['id']) && isset($vars['User']
['logged_in'])){
if($vars['User']['id']==$someone['User']['id'] &&
$vars['User']
['logged_in']==1){
$account_in_use = true;
break;
}
}
}
this piece of code helps checking for the logged_in status.
i'm wondering if you have usernames only in the sessions ?
can you read the usernames from another table, which is
related to the session entry ?
i would have been better of storing the logged_in status in another
table... but anyways, it works for now...
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 [EMAIL PROTECTED]
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
-~----------~----~----~----~------~----~------~--~---