You are here: Re: Setting Cookie « All PHP « IT news, forums, messages
Re: Setting Cookie

Posted by Ridge Burner on 07/21/05 17:35

I used print_r($_GET) at beginning of script and it returns:
Array ( [video] => hide )
so the var is set, but it is just not setting the cookie.
This script is copied from another domain (where it works fine), the only
difference between the two being the domain name in the 5th parameter.
Do you think I should put the setcookie and the [un]setcookie on different
pages like so:

PAGE1:
setcookie("video", "hide", time()+60*60*24*30*12, '/', 'mydomain.com');
header("Location: index.php");


&

PAGE2:
setcookie("video", "hide", time()-(60*60*24*30*12), '/', 'mydomain.com');
header("Location: index.php");


using: print_r($_COOKIE) || print_r($HTTP_COOKIE_VARS) || var_dump($_COOKIE)
returns 'NULL' when user is redirected to index.php

Ridge

"The Hub" <thehub@lofty.net.au> wrote in message
news:42dfada2$1@duster.adelaide.on.net...
> Your problem is here:
>
> if($_GET['video' == "hide"])
>
> 'video' == "hide" returns false.
> if($_GET[false]) returns false.
>
> "Ridge Burner" <nospam@nospam.com> wrote in message
> news:YDNDe.168689$x96.160514@attbi_s72...
>>I can't for some reason get this cookie to set! Am I not understanding the
>>correct way to do this? Here is the script:
>>
>> <?
>> if(isset($_GET['video'])){
>> if($_GET['video' == "hide"]){
>> setcookie("video", "hide", time()+60*60*24*30*12, '/',
>> 'mydomain.com');
>> }
>> if($_GET['video' == "show"]){
>> setcookie("video", "", time()-(60*60*24*30*15), '/',
>> 'mydomain.com');
>> }
>> }
>> header("Location: index.php");
>> ?>
>>
>> Any help would be appreciated!
>>
>> Ridge
>>
>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация