Jump to content

The worlds weirdest error in php, literally no explanation for it!


Recommended Posts

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();

}



?>

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.

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.