sorry, I was wrong ...
all the $session in my previous post should be $cookie... (I typed the wrong
word)

I think the domain is not the one that cause the problem...
remember that I refer to the same page (but sometimes success and the other
time it's fail)

What did u mean by "unless you use the right parameters in setcookie()"
Please more detail (I want to know if I miss something in setcookie
parameter)..

Thanx a lot
Flame

----- Original Message -----
From: "John W. Holmes" <[EMAIL PROTECTED]>
To: "Sukanto Kho" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, July 01, 2004 10:05 AM
Subject: Re: [PHP-DB] $cookie error


> Sukanto Kho wrote:
>
> > I'm using $_session to store user name and status
> >
> > and the session is used as key to access some pages
> >
> > and I set the cookie variables like this :
> >    setcookie ("name",$user_name, $time+3600);
> >    setcookie ("status",$status, $time+3600);
> >
> > and the authentication of the session variable like this :
> >   if(!isset($_COOKIE['name']) or !isset($_COOKIE['status']) or
$_COOKIE['status']!='user')
> >   {header("location:sign_in.php");exit;}
> >   else
> >   {$user_active=$_COOKIE['name'];$status=$_COOKIE['status'];}
> >
> > But the problem is that sometimes when I link to (eg : product_add.php
require $_session) it success but in the other time it's fail ..(although I
do it continuous ...I mean after the 1st time success and 2nd times fail)...
> > it couldn't be the problem of $_session lifetime ... I think.
> > I can't find "why" such problem occurs....
>
> $_SESSION and $_COOKIE are not the same thing. You seem to have them
> confused or are not explaining things very well.
>
> on "product_add.php" print out the contents of $_COOKIE and $_SESSION
> using print_r() so you can track what's in them and how they are changing.
>
> Cookies are tied to a domain, too. If you set a cookie on
> "domain.com/product.php" and then link to "www.domain.com/product.php"
> the cookie will not exist (unless you use the right parameters in
> setcookie()).
>
> --
> ---John Holmes...
>
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> php|architect: The Magazine for PHP Professionals – www.phparch.com
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to