Jump to content

All of a sudden


Distant_storm

Recommended Posts

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

 

Link to comment
https://forums.phpfreaks.com/topic/81944-all-of-a-sudden/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/81944-all-of-a-sudden/#findComment-416347
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.