Distant_storm Posted December 16, 2007 Share Posted December 16, 2007 My php script works like this it checks if the sessions is present and the values against a database and will direct to where they should be directed. If their login is wrong their directed to login page or if the session value isnt present then they are redirected. Now all of a sudden it is being tempremental and redirecting to login at what seems to be random times navigating around the system Quote Link to comment Share on other sites More sharing options...
Northern Flame Posted December 16, 2007 Share Posted December 16, 2007 post your script.... Quote Link to comment Share on other sites More sharing options...
Distant_storm Posted December 16, 2007 Author Share Posted December 16, 2007 this part of the code is in the index'd file if ($page_directory != 0 && check_auth_user_() != "ALLOW") { header("LOCATION:index.php?direct=0"); exit(); } $page_directory = navigation pointer check_auth_user_() checks login see code below. navigation pointer of 0 = login page. function check_auth_user_() { $matrix_path="MYSESSIONPATH"; ini_set('session.save_path',"../../" . $matrix_path . "_"); ini_set('session.gc_maxlifetime', '1440'); session_start(); if (isset($_SESSION['auth']) && isset($_SESSION['user_id'])) { if ($dbc = @mysql_connect('host','XXXXX','XXXXX')) { if (@mysql_select_db('DATEBASE')) { $name=$_SESSION['user_id']; $query="SELECT * FROM administration WHERE ID='$name'"; if ($r= mysql_query ($query)) { while ($row = mysql_fetch_array($r)) { $password=$_SESSION['auth']; $do_auth= md5($password . $row['key']); $auth_true= md5($row['password'] . $row['key']); if ($do_auth == $auth_true) { return("ALLOW"); } else { return("DENIE"); } } } } } } } that is the code for the check function. Non of the login has been changed, non of the database entries have changed??? What woudl make the script randomly log me out Quote Link to comment Share on other sites More sharing options...
marcus Posted December 16, 2007 Share Posted December 16, 2007 You got session_start(); on each page? Quote Link to comment Share on other sites More sharing options...
Distant_storm Posted December 16, 2007 Author Share Posted December 16, 2007 Yeh sorry i have and all the appropriate settings before setting the ini up. I didn't include my full code because theirs loads. If I can't figure this out im buggard hahha Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 16, 2007 Share Posted December 16, 2007 For code that does not work as expected, checking your web server log for errors is usually a good place start. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.