Page 1 of 1

cookies problem

Posted: Wed Jun 30, 2010 8:45 am
by overwise
ok, I don't really understand what's going on whit this...
i'm making this site where user may log in. when he log in, php code set the cookies and redirect user on his account. account page (account.php) recognizes him with this code:

Code: Select all

<?php
include "conn.php";
if(isset($_COOKIE['ID_my_site'])) { 
 	$name = $_COOKIE['ID_my_site']; 
	$pass = $_COOKIE['Key_my_site'];
..............
and that works fine. but, on account page i put link to another, edit page (edit.php) where user can change some informations, and that page also starts with the same code:

Code: Select all

<?php
include "conn.php";
if(isset($_COOKIE['ID_my_site'])) { 
 	$name = $_COOKIE['ID_my_site']; 
	$pass = $_COOKIE['Key_my_site'];
..............
but this time, cookies are not set on this page!!! i mean, when i made it, it was working fine, and it still do on my computer, but when i try it on my girlfriends computer, account.php gets cookies and display page as it should, but than edit.php display my else statement:

Code: Select all

} else {
echo "cookies NOT SET";
}
?>
i don't know if i explained my problem well, 'cuz i'm very confused with it.
thanks in advance!

Re: cookies problem

Posted: Wed Jun 30, 2010 9:10 am
by Jade
Cookies can be turned off in the browser. Use $_SESSION instead.

http://php.net/manual/en/reserved.variables.session.php