Connecting Tech Pros Worldwide Forums | Help | Site Map

cant read cookies

Duncan
Guest
 
Posts: n/a
#1: Jul 17 '05
Hi

I'm doing a site that creates a cookie and then needs to read that
cookie later.
The cookie is created fin and I can see it in my browsers cookies but I
can't seem to read it. I've tried referring to the variable straight as
$cookie_var and as $_COOKIE['cookie_var'] but no luck.
if I var_dump($_COOKIE) I get
array(0) { }

Is there something silly I'm missing? I thought it may be my firewall so
I got someone else to check and same story...

Thanks

Colin McKinnon
Guest
 
Posts: n/a
#2: Jul 17 '05

re: cant read cookies


Duncan wrote:
[color=blue]
> Hi
>
> I'm doing a site that creates a cookie and then needs to read that
> cookie later.
> The cookie is created fin and I can see it in my browsers cookies but I
> can't seem to read it. I've tried referring to the variable straight as
> $cookie_var and as $_COOKIE['cookie_var'] but no luck.
> if I var_dump($_COOKIE) I get
> array(0) { }
>
> Is there something silly I'm missing? I thought it may be my firewall so
> I got someone else to check and same story...
>[/color]

Sounds like a very clever firewall with a very dumb config if it can block
cookies - do cookies work on other sites?

Have you tried setting and reading a cookie from the same script - maybe its
a path issue.

HTH

C.

Duncan
Guest
 
Posts: n/a
#3: Jul 17 '05

re: cant read cookies


Colin McKinnon wrote:[color=blue]
>
> Sounds like a very clever firewall with a very dumb config if it can block
> cookies - do cookies work on other sites?
>
> Have you tried setting and reading a cookie from the same script - maybe its
> a path issue.[/color]

It's not not the firewall, it happens on other computers too. What
could prevent cookies being read? As mentioned before even
var_dump($_COOKIES) and print_r($_COOKIES) show no cookies at all. There
isn't a cookie_start() function or something like sessions is there? or
could it be a server thing? I'm stumped

Daniel Tryba
Guest
 
Posts: n/a
#4: Jul 17 '05

re: cant read cookies


Duncan <duncan@dotcomworld.co.za> wrote:[color=blue]
> It's not not the firewall, it happens on other computers too. What
> could prevent cookies being read? As mentioned before even
> var_dump($_COOKIES) and print_r($_COOKIES) show no cookies at all. There
> isn't a cookie_start() function or something like sessions is there? or
> could it be a server thing? I'm stumped[/color]

It's always a (very) _good_ idea to set errors to E_ALL when developing:
http://www.php.net/manual/en/reserve...iables.cookies

Helps avoiding these stupid typos :)

Also read http://nl3.php.net/manual/en/function.setcookie.php carefully,
especially the "Common Pitfalls" section.

Janwillem Borleffs
Guest
 
Posts: n/a
#5: Jul 17 '05

re: cant read cookies


Colin McKinnon wrote:[color=blue]
>[/color]

Multiposters should be banned from usenet... DO NOT MULTIPOST!

Another thread started in alt.php


JW


Closed Thread