Thanks Greg,

I'll try this, but I do not think this will solve the issue since at
first hand the session variables are correctly made.

The problem arrises (I think) whenever two or more users are logged in
and one closes the pages (so his session is killed I suppose).
Sometimes after that, the other users seem to get other values for the
user_id session variable.
Strange thing is the other session (like first_name or last_name)
variables of the user stay correct. Only the user_id session variable is
changed.

I don't know if this can be caused by the fact register_globals seem to
be 'on' on the server (btw PHP Version 4.2.3)

Thx for the advice, I hope I can sort it out soon

Greetz
Reinhart




-----Original Message-----
From: Greg Donald [mailto:[EMAIL PROTECTED] 
Sent: donderdag 21 oktober 2004 15:47
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Sessions question


On Thu, 21 Oct 2004 14:43:45 +0200, Reinhart Viane <[EMAIL PROTECTED]> wrote:
> Hey Mike,
> 
> After some intensive testing it seemed that $user_id did not solve the

> isue
> 
> I hereby give the script to get the $user_id:
> 
> // check if the user info validates the db
> ($username and $password are the POST values of username and password 
> given in on a form) $sql = mysql_query("SELECT * FROM users WHERE 
> username='$username' AND password='$password' AND activated='1'");
> $login_check = mysql_num_rows($sql);
> 
> if($login_check > 0){
>         while($row = mysql_fetch_array($sql)){
>         foreach( $row AS $key => $val ){

Your select * query above is probably pulling more than two fields, so a
$key and $val in the foreach() will only work with two of those fields,
the other fields will be unhandled.  You might want to ditch the
foreach() loop and just use the while() loop by itself since you can
easily access all the fields from your query in the $row array.



-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to