kalm1234 Posted May 24, 2010 Share Posted May 24, 2010 Hi all, Recently, I upgraded my apache and PHP version at the same time. When I did, it seemed like it was a smooth upgrade and nothing had gone wrong. I tested my site locally, but a friend of mine tried it and he had a problem logging in. The cookies were not working remotely, but were working locally. My php version is 5.3.2. My site was working perfectly before, but since I upgraded, the cookies scripts I made have not been working for remote users. Any ideas? Link to comment https://forums.phpfreaks.com/topic/202704-php-cookies-not-working-remotely/ Share on other sites More sharing options...
Riparian Posted May 24, 2010 Share Posted May 24, 2010 I certainly do not know much about this but have you spoken to your host ? could it be the location of your session cookies temp file that has got lost in the upgrade... Just a thought but I would certainly ask them Link to comment https://forums.phpfreaks.com/topic/202704-php-cookies-not-working-remotely/#findComment-1062475 Share on other sites More sharing options...
kalm1234 Posted May 24, 2010 Author Share Posted May 24, 2010 I host my own server. I double checked the session section in my php.ini and cannot find a problem, though that's not saying much as I am new to this. Here is my login page: <?php $user = $_POST['username']; $pass = $_POST['password']; if (($user == "") || ($pass == "")) { echo 'Please enter the form correctly.'; exit(); } if (file_exists("../../users/".$user.".php")) { $userfile = "../../users/".$user.".php"; $fh = fopen($userfile, 'r'); $contents = fread($fh, filesize($userfile)); $lines = explode("\n",$contents); fclose($fh); if (crypt($pass, $lines[6]) == $lines[6]) { $ip=$_SERVER['REMOTE_ADDR']; if ($ip == '127.0.0.1') { setcookie("loginhda5", $user, time()+3600, "/", "127.0.0.1"); } else { setcookie("loginhda5", $user, time()+3600, "/", "65.5.164.229"); } } else { echo "The username or password you entered is invalid. Please <a href='../index.php'>try again</a>"; } } else { echo "The username or password you entered is invalid. Please <a href='../index.php'>try again</a>"; } ?> Sorry if its not spaced out enough. I'm pretty sure there is nothing wrong in the code (nothing that would prevent it from working anyway). Link to comment https://forums.phpfreaks.com/topic/202704-php-cookies-not-working-remotely/#findComment-1062478 Share on other sites More sharing options...
Riparian Posted May 24, 2010 Share Posted May 24, 2010 what about permissions ? especially for ../../users/".$user.".php"; Just a thought Just strange that it was fine before the upgrade p.s. your friend did not have cookies blocked ? Link to comment https://forums.phpfreaks.com/topic/202704-php-cookies-not-working-remotely/#findComment-1062486 Share on other sites More sharing options...
kalm1234 Posted May 24, 2010 Author Share Posted May 24, 2010 The script does not give me any errors when trying to open the file, so I didn't think it was a problem with the folder permissions. My friend has cookies enabled because he had never had a problem with it before. Also, now I am getting messages from others that they are having trouble too. Link to comment https://forums.phpfreaks.com/topic/202704-php-cookies-not-working-remotely/#findComment-1062488 Share on other sites More sharing options...
kalm1234 Posted May 25, 2010 Author Share Posted May 25, 2010 For the time being until I can find out what is wrong with cookies, I switched to sessions. I checked my folder permissions and they allowed for read/write, so that's not the problem either :-\ Link to comment https://forums.phpfreaks.com/topic/202704-php-cookies-not-working-remotely/#findComment-1062860 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.