Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 199901

Re: [PHP3] reading cookies From: Amitay B Isaacs (amitay <email protected>)
Date: 01/20/99

On Wed, Jan 20, 1999 at 05:12:37PM -0500, Paul Lynch wrote:
> Okay, I have a new problem today. I am checking to see if a value exists
> in a cookie on the user end, and if it doesn't redirect the user to an
> alternate page, where the value will be created and set to the users cookie
> if available.
>
> if ($userid == "") {
> $userid = $HTTP_COOKIE_VARS["permid"];
> }
>
> if ($userid == "") {
> header("Location: ".
> $sess->url("http://host.domain.com/site/entry1.php3"));
> }
>
>
> For some reason though it doesn't seem to execute the code when the page
> first loads, but if we do a refresh it realizes it doesn't have a cookie
> and goes on to the entry1.php3. It behaves the same way if you have
> cookies turned on or not. Anyone have any ideas?

If you have set_cookie and Location in the same page, set_cookie does not
work. So if you want to set the cookie and also redirect in the same page,
rather than using Location header, you can use refresh in the meta tag in
the header.

Hope that helps.

Amitay.

-- 

A PENNY saved is not spent.

-- PHP 3 Mailing List http://www.php.net/ To unsubscribe send an empty message to php3-unsubscribe <email protected> To subscribe to the digest list: php3-digest-subscribe <email protected> For help: php3-help <email protected> Archive: http://www.php.net/mailsearch.php3 List administrator: zeev-list-admin <email protected>