TobesC Posted June 6, 2007 Share Posted June 6, 2007 im trying to run sessions, but when i log in and go to the search page, it doesnt recognize the existing session, but when i do a search where i post variables back to that page, it recognizes the session data the second time. anyone know the problem? Link to comment https://forums.phpfreaks.com/topic/54369-session-problems/ Share on other sites More sharing options...
sanfly Posted June 6, 2007 Share Posted June 6, 2007 You will need to post your code Link to comment https://forums.phpfreaks.com/topic/54369-session-problems/#findComment-268869 Share on other sites More sharing options...
TobesC Posted June 6, 2007 Author Share Posted June 6, 2007 here is the authentication i use. login script: -user submits email and password <?php session_start(); if (!isset($_SESSION['tries'])) { session_register($_SESSION['tries']); $_SESSION['tries']=0; } mysql_connect; mysql_select_db; $email=trim(strip_tags($_POST['email'])); $password=trim(strip_tags($_POST['password'])); if ($email!="") { $result=mysql_query("SELECT * FROM `users` WHERE `email`='$email'"); $row=mysql_fetch_array($result); if ($password==$row['password']) { session_register($_SESSION['uid']); $_SESSION['uid']=$row['uid']; session_register($_SESSION['email']); $_SESSION['email']=$email; session_register($_SESSION['session']); $_SESSION['session']=session_id(); header ("location: ../index.php"); } else { $_SESSION['tries']=$_SESSION['tries']+1; if ($_SESSION['tries']>2) { header ("location: ../reset.php"); } else { header ("Location: ../index.php"); } } } else { header ("Location: ../index.php"); } ?> authentication check (at beginning of each page of site): session_start(); $now=session_id(); $session=$_SESSION['session']; if ($now==$session) { $logged="y"; } if $logged equals y, other options are present. any help would be greatly appreciated. this is driving me crazy. Link to comment https://forums.phpfreaks.com/topic/54369-session-problems/#findComment-268958 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.