Re: [phplib] Problem with newly commited user4.inc From: Max A. Derkachev (kot <email protected>)
Date: 01/05/01

Hello Marko,

Friday, January 05, 2001, 2:21:42 PM, you wrote:

MK> Right now I noticed that session/user data is stored in php4 manner and
MK> not the way it was before in phplib3 (I mean as clear php code). In
MK> principle this is okay, I think. But at least for me it causes a little
MK> problem now: I cannot simply use the same tables if I switch between old
MK> phplib3 or Brian's phplib4-extension and your approach.

A simpliest program to convert old user data to the new format:
(Call it with the *OLD* user class.)
<?php
$db = new DB_Sql;
$query = "select sid from active_sessions "
       . "where name = 'Your_user_class' ";
while ($db->next_record()) {
 $user = new Your_User_Class;
 $user->start($db->f('sid'));
 $user_vars = array();
 while (list ($key) = each ($user->pt)) {
   $user_vars[$key] = $$key;
 }
 $value = serialize($user_vars);
 $user->that->ac_store($user->id, $user->name, $value);
 $user->release_lock();
 // don't call page_close()
?>

This should convert all the user data in the table to the new format.

-- 
Best regards,
Max A. Derkachev mailto:kot <email protected>
Symbol-Plus Publishing Ltd.
phone: +7 (812) 324-53-53
http://www.Books.Ru -- All Books of Russia
 

--------------------------------------------------------------------- To unsubscribe, e-mail: phplib-unsubscribe <email protected> For additional commands, e-mail: phplib-help <email protected>