freemancomputer Posted February 22, 2012 Share Posted February 22, 2012 I'm not really sure if this is a cookie problem but that's all I could think of. I have a web site that users have to log into. I have seen that when I log out of my account and log into my test account my main user name will still show on the welcome page unless I let the computer sit for a bit or if I clear recent history. This happens in all the main browsers. I have also started having a problem where if I update something in my database it shows up in MySQL right away but can take a while to show up on the web page unless i clear the history. Not sure what code to post to give you an idea so if you want to see something let me know and I will put it up. Thank you Quote Link to comment https://forums.phpfreaks.com/topic/257567-cookie-probloms/ Share on other sites More sharing options...
AyKay47 Posted February 22, 2012 Share Posted February 22, 2012 This first issue would be related to your logout script and the way that you are using cookies. Quote Link to comment https://forums.phpfreaks.com/topic/257567-cookie-probloms/#findComment-1320169 Share on other sites More sharing options...
scootstah Posted February 22, 2012 Share Posted February 22, 2012 Could be a cache issue. Quote Link to comment https://forums.phpfreaks.com/topic/257567-cookie-probloms/#findComment-1320171 Share on other sites More sharing options...
freemancomputer Posted February 22, 2012 Author Share Posted February 22, 2012 This i what I have for my log out script <? session_start(); session_destroy(); header("location:login.php"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/257567-cookie-probloms/#findComment-1320172 Share on other sites More sharing options...
scootstah Posted February 22, 2012 Share Posted February 22, 2012 Are you setting additional cookies in your login? Quote Link to comment https://forums.phpfreaks.com/topic/257567-cookie-probloms/#findComment-1320173 Share on other sites More sharing options...
freemancomputer Posted February 22, 2012 Author Share Posted February 22, 2012 This is my log in scrip include"scripts/connect.php" ; mysql_connect('localhost',$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $encrypted_password=md5($mypassword); $sql="SELECT * FROM user WHERE username='$myusername' and password='$encrypted_password' and active=1"; $result=mysql_query($sql); $count=mysql_num_rows($result); $row = mysql_fetch_assoc($result); $rank = $row['rank']; $loggedinusername = $row['username']; $loggedinuseremail = $row['email']; if($count==1){ session_start(); $_SESSION['login'] = "1"; $_SESSION['rank'] = $rank; $_SESSION['loggedinusername'] = $loggedinusername; $_SESSION['loggedinuseremail'] = $loggedinuseremail; header ("Location:index.php"); } else { $errorMessage = "Invalid Login"; session_start(); $_SESSION['login'] = ''; header ("Location:login.php"); } and this is my session session_start(); if(!$_SESSION['login']){ $_SESSION['rank']; $_SESSION['loggedinusername'] = $loggedinusername; $_SESSION['loggedinuseremail'] = $loggedinuseremail; header("location:login.php"); } $rank=$_SESSION['rank']; $loggedinusername=$_SESSION['loggedinusername']; $loggedinuseremail=$_SESSION['loggedinuseremail']; Quote Link to comment https://forums.phpfreaks.com/topic/257567-cookie-probloms/#findComment-1320176 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.