[PHP] Poblem with sesions
Hi , I am having problem with log in and log out . I have a main login page where one can login with the username and password stored in mysql database. PHP Code: location.href='$adminAddress'; exit(); } else if ($accesslevel == "user") { $_SESSION['level'] = "user"; $_SESSION['username'] = $_POST['UserName']; $_SESSION["userid"] = login($_POST); include ('userlogin.php'); exit(); } } else { //$_SESSION['loggedIn'] = false; unset ($_SESSION['userid']); unset ($_SESSION['username']); unset ($_SESSION['level']); echo "Error :$error"; } } //ob_end_flush(); ?> so after login user is directed to the corresponding page. The problem is that when some user is logged in to the user page or admin page, at the same time if i want to login to the user page from other computers , it lets me login but after that whatever link i click in userlogin page, takes me back to login page. And i have to log in to userpage and click on log out and then it will work. its quite strange and i dont know why it is acting like this. Also in userlogin page i am have a link to other page which i am calling by PHP Code: if ($_GET['mode'] == "basketball"){ include ('basket_closed.php'); } and link is userlogin.php?mode=basketball My Log out script is PHP Code: I need help on this...i couldn't came up with any clue, Any idea.. i really appreciate your help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with sessions on Log in and Log out
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
[PHP] Problem Directing the Page with header
Hi, I am having problem with redirecting the page in user authenication page . I am working on my windows machine as a localhost with PHP Version 5.2.0. Everything is working good in local machine (in Windows) but now when i tried to upload the same code to the server which is using PHP Version 5.1.6, it does not seem to redirect my page. I have a main loginpage which on post goes to the logincheck.php and in Login.php i have all the stuffs to authenticate and redirect the user. I am pasting the logincheck.php code below. Any Help would be highly aprriciated. Thanks a lot -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php