This topic is locked

Losing variable values after login or logout

8/2/2007 18:39:46
PHPRunner General questions
jpedwardspost author

Hi,
I have a website (non-phprunner) where I can login as an 'admin user' by setting a variable - this displays extra functionality when I reload my page.
Problem is, if I then login to a phprunner website in a new tab I lose my 'admin variable' (which means I have to login again as admin on my non-phprunner website.
The same thing happens if I logout of the phprunner website - I lose my admin variable.
I am guessing my session is being reset. How can I get around this - I'm getting sick of having to keep relogging in all the time <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=5903&image=1&table=forumtopics' class='bbc_emoticon' alt=':)' />
Cheers,

JP.

Sergey Kornilov admin 8/2/2007

This involves two steps:
1.Use AfterSuccessfulLogin event to set your admin variable
2. Modify generated login.php file to set admin variable after session is destroyed.

if(@$_POST["a"]=="logout" || @$_GET["a"]=="logout")

{

session_unset();

// add your code here

setcookie("username","",time()-365144060);

setcookie("password","",time()-365144060);

header("Location: login.php");

exit();

}