Page 1 of 1

problems with cookies

Posted: Fri Jul 25, 2003 12:57 pm
by psychotomus

Code: Select all

<?php
	if (!isset($_COOKIE&#1111;'user_'])) &#123;
	setcookie("user_","",time()+60*60*24*30 ,"/naruto/","www.po2.net",1);
                setcookie("pass_","",time()+60*60*24*30 ,"/naruto/","www..po2.net",1);
		print $HTTP_COOKIE_VARS&#1111;'user_'];
	&#125; 

?>
im trying to store cookies, but it doesnt seem to write to my computer, and everytime i access $user_ it says undefined index... is there something wrong with my setcookies?

Posted: Fri Jul 25, 2003 1:27 pm
by kcomer
First off, you can't set a cookie and use it in the same page. Second of all, choose a standard and go with it, don't use $HTTP_COOKIE_VARS and then use $_COOKIE. I'd go with $_COOKIE

Posted: Fri Jul 25, 2003 1:41 pm
by psychotomus
why cant you use a cookie after setting it on the same page?
i was testing them, none of them seemed to work.

Posted: Fri Jul 25, 2003 2:10 pm
by psychotomus
cookies wont set

Code: Select all

if (!isset($_COOKIE&#1111;'user_'])) &#123;
		setcookie("user_",".",time()+60*60*24*30 ,"/naruto/","www.po2.net",0);
		setcookie("pass_",".",time()+60*60*24*30 ,"/naruto/","www..po2.net",0);
		print 1;
	&#125;
no matter how many times i visit this page, the cookies wont end up on my computer. how do i set cookies?