Jump to content

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

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.