Jump to content

setcookie issue ONLY in IE


joquius

Recommended Posts

Ok, for some reason lately (probably due to a change I made) a session script I've been using for years has stopped working properly in IE6-7. Quite simply it is not creating cookies.

The strange thing is, that it does create cookies for anonymous sessions, but not for regular user sessions (they both share the same setcookie() function)

Here's some code:
[code]
function s_create ($user_id)
{
global $c_time; // current time
global $_config;
$s_expire = db_data ("user_level", "s_expire", "level_id", db_data ("user_list", "user_level", "user_id", $user_id)); // 3600 in this case
$user_ip = $_SERVER['REMOTE_ADDR'];
$s_id = md5 (uniqid ($user_ip).$c_time);
setcookie ($_config['s_cookie_name'], $s_id, $s_expire + $c_time, "/");
mysql_query ("DELETE FROM `user_sessions` WHERE `s_expire` + `s_active` <= '$c_time' && `user_id` = '$user_id' && `user_id` != '-1' || `user_id` = '-1' && `user_ip` = '$user_ip'"); // deletes inactive sessions
mysql_query ("INSERT INTO `user_sessions` VALUES ('$s_id', '$user_id', '$user_ip', '$c_time', '$s_expire')"); // create session in database
return $s_id;
}
[/code]

It just doesn't create a cookie for '$user_id' = 1 and obviously there aren't many options because there are no problems in firefox. Is there any chance any other function here could have any difference. Any Ideas?
Link to comment
https://forums.phpfreaks.com/topic/25900-setcookie-issue-only-in-ie/
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.