Jump to content

[SOLVED] Cookie not being set by page


Voodoo Jai

Recommended Posts

I have a page that is supposed to set a cookie but when I check the cookies its not there. part of the code is here:

 

<?php
if($_GET["action"] == "2"){
    $username = $_POST["username"];
    $password = $_POST["password"];
    $referrer = "http://host.com";
    if($username == "username" && 
       $password == "password" && 
       str_replace("www.", "", $_SERVER['HTTP_REFERER']) == $referrer."statistics2.php")
   {

        setcookie("JumboJai", "poochimasta", 0);

    }
}
?>

If I set the cookie not to be TRUE then my page does what its supposed to:

 

<?php
if($_COOKIE["JumboJai"] != "poochimasta")
{
mysql_select_db($database_host_conn, $host_conn);
echo "COOKIE WORKING";
?>

I'm confused.com LOL

 

VoodooJai

Link to comment
https://forums.phpfreaks.com/topic/125941-solved-cookie-not-being-set-by-page/
Share on other sites

After a bit of digging I get this error msg

 

Warning: Cannot modify header information - headers already sent by (output started at /hsphere/local/home/poochima/lostmymenu.com/statistics2.php:3) in /hsphere/local/home/poochima/lostmymenu.com/statistics2.php on line 13

 

Warning: Cannot modify header information - headers already sent by (output started at /hsphere/local/home/poochima/lostmymenu.com/statistics2.php:3) in /hsphere/local/home/poochima/lostmymenu.com/statistics2.php on line 15

 

it looks as though it wont let me set the cookie at line 13 of the pagewhy is this.

 

VoodooJai

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.