The14thGOD Posted March 25, 2010 Share Posted March 25, 2010 Safari isnt reading the cookie through php. But if I go to prefs>security>show cookies, it's there. Anyone got any ideas? Code is below, works in FF. <?php if(isset($_SESSION['username'])){ $user_query = "SELECT * FROM challenge_users WHERE username=LOWER('".mysql_real_escape_string($_SESSION['username'])."') AND password='".mysql_real_escape_string($_SESSION['password'])."' LIMIT 1"; $user_result = mysql_query($user_query); if(mysql_num_rows($user_result) != 0){ $user_row = mysql_fetch_assoc($user_result); if(!isset($_COOKIE['cotw'])){ //set cookie to avoid doing double cookies //also set session incase user doesnt accept cookies setcookie("cotw","$row[username];$row[password];$row[name];$row[email]",time()+3600*24*90); } $loggedin = true; } }elseif(isset($_COOKIE['cotw'])){ $xplod = explode(';',$_COOKIE['cotw']); $user_query = "SELECT * FROM challenge_users WHERE username=LOWER('".mysql_real_escape_string($xplod[0])."') AND password='".mysql_real_escape_string($xplod[1])."' LIMIT 1"; echo $user_query; $user_result = mysql_query($user_query); if(mysql_num_rows($user_result) != 0){ $user_row = mysql_fetch_assoc($user_result); $_SESSION['username'] = $user_row['username']; $_SESSION['password'] = $user_row['password']; $_SESSION['name'] = $user_row['name']; $_SESSION['email'] = $user_row['email']; $loggedin = true; $test = true; } } ?> Thanks for any and all help. Justin Quote Link to comment https://forums.phpfreaks.com/topic/196532-cookie-is-crumbling-in-safari/ Share on other sites More sharing options...
The14thGOD Posted March 25, 2010 Author Share Posted March 25, 2010 Solved it, for future reference, if anyone cares. You need to specify the path for Safari, to at least the folder (havn't tried doing just '/'). ie: <?php setcookie('name','value',time()+3600*24*90,'/path/to/folder/'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/196532-cookie-is-crumbling-in-safari/#findComment-1031851 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.