Cookie problems and safari? (Calling web devs for help)
I've spent way too long trying to figure this out with my site, but for some reason Safari would not set cookies with the appropriate path. If not explicitly specified, the path would be listed as specific to that page. So, if I had a page "login_success.php" the cookie set on that page as a result of the successful login would only work for that page. So, despite being logged in successfully, the user would never appear so except on that specific page.
Now, I'm just a cookie novice, so I don't know if that's how it's supposed to work. Can anyone shed some light on this issue for me?
TIA.
Now, I'm just a cookie novice, so I don't know if that's how it's supposed to work. Can anyone shed some light on this issue for me?
TIA.
Comments
[quote]
If set to '/', the cookie will be available within the entire domain. If set to '/foo/', the cookie will only be available within the /foo/ directory and all sub-directories such as /foo/bar/ of domain. The default value is the current directory that the cookie is being set in.
<hr></blockquote>
It doesn't make any sense that the path would be set to a specific file as it has been. It works fine in other browsers, btw. Maybe they're being more forgiving?
So, is it a Safari issue or am I doing something wrong? BTW, I've already sent a bug-report to Apple in case it's a bug...
Come on, someone must know the answer or have seen the issue, right?
I have gotten around the issue by declaring '' (that is two single quotes) as the path in my setcookie function. Some browsers choke if you don't specify every argument explicitly. So in PHP (setcookie - PHP right?) I use this syntax:
[code]
$cookie = setcookie('name', 'value', 'time()+3600', '', 0)
if ($cookie !== 1) {
echo "CRAP!";
} else {
echo "HOLY CRAP!";
}</pre><hr></blockquote>
<strong>Like you I have found various browsers accept cookies in different ways when you don't specify a path. I have even found that specifying / as your path doesn't always work correctly.
I have gotten around the issue by declaring '' (that is two single quotes) as the path in my setcookie function. Some browsers choke if you don't specify every argument explicitly. So in PHP (setcookie - PHP right?) I use this syntax:
[code]
$cookie = setcookie('name', 'value', 'time()+3600', '', 0)
if ($cookie !== 1) {
echo "CRAP!";
} else {
echo "HOLY CRAP!";
}</pre><hr></blockquote></strong><hr></blockquote>
Ah, thanks. I'm a n00b programmer and I'm always unsure if I'm doing things right. Glad to see it's not me.
That's ok - I'm a complete hack - I always think I am doing it right until I get all kinds of error messages spewing across the page. :eek:
<strong>I to have had cookie problems with safari... My cookies do work and safari remembers then but for some reason safari either doesnt like my header or i dunno but it makes me mad...</strong><hr></blockquote>
More info?