|
Posted by anndr0id on 08/14/07 19:58
On Aug 14, 1:28 pm, ELINTPimp <smsi...@gmail.com> wrote:
> On Aug 14, 1:00 pm, anndr0id <anndr...@gmail.com> wrote:
>
> > Hey Guys - Ever see anything like this? I've set a cookie successfully
> > (it is showing up correctly in my cookies) but when I try to reference
> > the cookie via $_COOKIE, it is returning an undefined, and
> > print_r($_COOKIE) only brings up one cookie, [PHPSESSID] =>
> > 7j3r750kojkdig8k6uf34adpd7, although I've set quite a few cookies.
> > It's happening under both mozilla and safari, yet the cookies set are
> > appearing in both. Weird huh?
>
> > Any help would be very appreciated! :)
>
> print_r($_COOKIE) only brings up one cookie, [PHPSESSID] =>
>
> > 7j3r750kojkdig8k6uf34adpd7, although I've set quite a few cookies.
>
> Looks like you have sessions running =), normal stuff
>
> can you post the code you are using to create/call the cookie, please?
Of course. I currently have a password session on the site because it
isn't public yet :)
Create (setcookie.php):
<?php
setcookie("BW_zip", $_REQUEST['zip'], strtotime("+1 year"));
setcookie("BW_address", $_REQUEST['address'], strtotime("+1 year"));
setcookie("BW_phone", $_REQUEST['phone'], strtotime("+1 year"));
setcookie("BW_price", $_REQUEST['price'], strtotime("+1 year"));
?>
<script language="javascript">
window.location = "../index.php";
</script>
Call (location.php):
<?pho
header("Content-type: text/xml");
if(IsSet($_COOKIE["BW_zip"])) {
$locSet = "yes";
$zip = $_COOKIE["BW_zip"];
$address = $_COOKIE["BW_address"];
$phone = $_COOKIE["BW_phone"];
$price = $_COOKIE["BWW_price"];
} else {
$locSet = "no";
$zip = " ";
$address = " ";
$phone = " ";
$price = "no";
}
$xmlstr = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n";
$xmlstr .= "<location>";
$xmlstr .= "<store locSet=\"$locSet\" zip=\"$zip\" address=\"$address
\" phone=\"$phone\" price=\"$price\"></store>";
$xmlstr .= "</location>";
echo $xmlstr;
?>
and in another test.php file I tried:
<?php
print_r($_COOKIE);
?>
It all looks correct to me. Not sure why the calls aren't seeing the
cookie, they are reporting all the data correctly on my computer.
Navigation:
[Reply to this message]
|