Re: Help with sessions on Log in and Log out

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
        Firstly , you should unset all of session variables an then you 
should destroy the session variables. After this process, redirect the page 
to HTML file (for example quit.html). By the way , you should use the GET 
variables or POST variables to quit.
if (isset($_GET['quit']))
{
   session_unset();
   session_destroy();
   include('quit.html');
   exit;
}

        in quit.html load the main page of your web site. If you can apply 
this process, you can easily quit the application. If you have even click 
the back button, you wouldn't have entered the page.
quit.html code

<html>
<body>
<script type="text/javascript">
window.top.location="index.php"
</script>
</body>
</html>


-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net


""Ashish Rizal"" <arizal@xxxxxxxxxxxxxx>, haber iletisinde þunlarý 
yazdý:1171775032-14069.00021.00021-smmsdV2.1.6@xxxxxxxxxxxxxxxx
>I am having some problem working with my script on session
> stuffs. Well, i have a login page which authenticates users by
> using sql script then if login is successful i have
> PHP Code:
>
> $_SESSSION['logged in']=true; and $_SESSION[userid]=$userid
>
> and when login is true i have included the page based on the
> access level of users . Like if it is a regular user i have
> include "user.php" ; exit() and if admin i have included admin page.
>
> Also i have a log out script which unsets the sessions variable
> and distroy the session at last.
> Also when admin loggs in to admin page i have a small php script
> that checks for those session variables and if the are set and
> "is true" then the pages are displayed.
>
> My problem is when admin just comes out to the login page again
> without log out it allows to login to the main page but in main
> page if any < a href> link is clicked it goes back to login page.
> So then i will have to go back and log out first and then log
> in.. I am not sure why this strange things happens.
> Also is there any way i can have a feature like when the users
> click back button it wont allow to go back to that page unless he
> is using the back button provided by the web interface.
>
> I am new at the session stuffs, so i am not sure what i am doing
> is really a safe way to code a php page. are there any other
> things that i need to be aware of while using sessions.
>
> Any suggestions or thoughts would be highly appreciated.
> Thanks 

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux