turkman Posted October 16, 2010 Share Posted October 16, 2010 My site keeps track of people using cookies. This is stored in $cookie['supercookie']; There area mods who can recommend normal posters to become mods. What it does its sends the persons cookie to recommend.php recommend.php looks like this. Note when i recommend someone, for some reason my cookie gets unset and it will not let me set a new cookie. I literally don't understand why as the $_cookie['supercookie'] variable is NEVER referneced. i read the GET info containing their cookie, check to see its not and admin or mod, then if they are not i submit their cookie to the pword table and get their uname (this isnt alwatys set) -> Then i add it into a pending table. The script executes perfectly, however for some weird reason it unsets my cookie and wont let me set another one. Its doing my head in. <?php session_start(); include $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.php"; if(isset($_SESSION['lv'] )AND $_SESSION['lv'] > 4){ $pass = "*Private*"; if(isset($_GET['cook'])){ $recby = "Not recorded"; $ck = protect($_GET['cook']); if(!_is_admin($ck) && !_is_mod($ck)){ //everything is fine. //uname,pass,scookie,recby //get details. $res = mysql_query("SELECT * FROM pword WHERE scookie = '$ck'AND level = 'Norm' LIMIT 1") or die(mysql_error()); $row = mysql_fetch_array($res); $uname = stripslashes($row['uname']); mysql_query("INSERT INTO nwg (uname,pass,scookie,recby) VALUES ('$uname','$pass','$ck','$recby')")or die(mysql_error()); add_notice("User: <strong>$uname</strong> has been recommended"); echo "<script>location.href='http://www.imgboard.co.uk/'</script>"; } else{ add_notice("You shouldn't have been able to do that!"); addaction(8,"Recommended /kbos"); echo "<script>location.href='http://www.imgboard.co.uk/'</script>"; die(); } } else{ add_notice("You need to specify a cookie id!"); echo "<script>location.href='http://www.imgboard.co.uk/'</script>"; die(); } } else{ add_notice("Restricted Area"); echo "<script>location.href='http://www.imgboard.co.uk/'</script>"; die(); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/215985-the-worlds-weirdest-error-in-php-literally-no-explanation-for-it/ Share on other sites More sharing options...
PFMaBiSmAd Posted October 16, 2010 Share Posted October 16, 2010 I don't see any code in there that is setting the cookie in question, but the best guess is your cookie is 'missing' because you are redirecting to a host-name/sub-domain (www. vs no www) that is different than where the cookie was set and the cookie parameters are not set to match all variations of your domain. Quote Link to comment https://forums.phpfreaks.com/topic/215985-the-worlds-weirdest-error-in-php-literally-no-explanation-for-it/#findComment-1122643 Share on other sites More sharing options...
turkman Posted October 16, 2010 Author Share Posted October 16, 2010 i set all cookies using the / option, and even then its all in the www. I managed to stop the error by removing the code that gets their username. Thats stopped the bug bug but i still cant uderstand what caused it Quote Link to comment https://forums.phpfreaks.com/topic/215985-the-worlds-weirdest-error-in-php-literally-no-explanation-for-it/#findComment-1122695 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.