joquius Posted November 12, 2006 Share Posted November 12, 2006 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/27032-setcookie-issue/ Share on other sites More sharing options...
fert Posted November 12, 2006 Share Posted November 12, 2006 The setcookie function requires the url of your website to work Link to comment https://forums.phpfreaks.com/topic/27032-setcookie-issue/#findComment-123611 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.