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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.