Jump to content

Cookie is crumbling... in Safari


The14thGOD

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/196532-cookie-is-crumbling-in-safari/
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.