cookies in different pages

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
m2babaey
Forum Contributor
Posts: 364
Joined: Sun May 20, 2007 9:26 am

cookies in different pages

Post by m2babaey »

Hi
I am wondering why my cookie is not working in another page.
please check if there is a problem:
first page: refer.php:
link: http://sp724.com/members/refer.php?user=1
code:

Code: Select all

<?php
 
        if(isset($_GET['user']) AND is_numeric($_GET['user']) ) {
  $userid=$_GET['user'];        
  $in1Month1 = 60 * 60 * 24 * 30 + time(); 
  setcookie('refferer', $userid, $in1Months); 
if(isset($_COOKIE['refferer'])){
    $referer = $_COOKIE['refferer'];
    echo $referer;
    }
} 
//header("Location: http://rooyekhat4u.com");
?>
2nd page:
link: http://www.sp724.com/members/saleconfirmed.php
code:

Code: Select all

<?php
    if(isset($_COOKIE['refferer'])){
    $referer = $_COOKIE['refferer'];
    echo $referer;
    }
 
?>
but the first result is different with the second one
wmguk
Forum Newbie
Posts: 16
Joined: Wed Jan 30, 2008 6:16 am

Re: cookies in different pages

Post by wmguk »

hey,

how do you mean? I just tried your pages out, first setting user=1 and then user=4, and when viewing your second page, it reported 1, and 4 so seems correct to me?
m2babaey
Forum Contributor
Posts: 364
Joined: Sun May 20, 2007 9:26 am

Re: cookies in different pages

Post by m2babaey »

i tried again using ie. my firefox is not accepting cookies it seems.
thank you
Post Reply