SESSION EXPIRED - SOLUTION (LINUX PHP5)

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
miki
Posts: 1
Joined: Tue Feb 07, 2006 9:52 am

SESSION EXPIRED - SOLUTION (LINUX PHP5)

Post 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
Klemen
Site Admin
Posts: 10141
Joined: Fri Feb 11, 2005 4:04 pm

Post 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
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Klemen
Site Admin
Posts: 10141
Joined: Fri Feb 11, 2005 4:04 pm

Post 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,
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Post Reply