Page 1 of 1

SESSION EXPIRED - SOLUTION (LINUX PHP5)

Posted: Tue Feb 07, 2006 9:59 am
by miki
Version of script: 0.93
Version of PHP: 5
OS: Linux - Fedora Core 4
-------------------------------------------
Here is the solution for the Session Expired issue in the admin login.
in the file admin.php remark line 63, so it looks like that:

Code: Select all

//$_SESSION=hesk_dbFetchAssoc($result);
Now, add this code block right after line 63:

Code: Select all

$row=mysql_fetch_array($result);
$_SESSION['pass']=$row['pass'];
$_SESSION['isadmin']=$row['isadmin'];
$_SESSION['id']=$row['id'];
$_SESSION['name']=$row['name'];
$_SESSION['user']=$row['user'];
$_SESSION['email']=$row['email'];
$_SESSION['user']=$row['user'];
$_SESSION['signature']=$row['signature'];
$_SESSION['categories']=$row['categories'];
$_SESSION['notify']=$row['notify'];

Have fun :)
Miki

Posted: Tue Feb 07, 2006 10:35 am
by Klemen
Hi,

Thanks for sharing, whatever works is welcome :) If you read a few old posts you will see a lot of people have different solutions for this problem. I am not sure why fetching the array to $row first and then to $_SESSION would help, but like said, whatever works :lol:

Regards

Posted: Tue Feb 07, 2006 10:50 am
by Klemen
Just an update: I see now why this would help, it keeps any other variables stored in $_SESSION before the fetch from MySQL.

I would recommend rather using the solution below. It basically does the same thing, but is more robust (won't require modifying) for future releases where new columns might be added to the hesk_users table.

The solution is to simply change line 62 from

Code: Select all

$_SESSION=hesk_dbFetchAssoc($result); 
to

Code: Select all

$_SESSION+=hesk_dbFetchAssoc($result); 
Note all we did is added a plus (+) before the equals sign (=). No other editing necessary.

I have included the change in original release in case it helps anyone else.

Thanks miki!

Regards,