hi all
i am having an unusual and frustrating problem. i am trying to set cookies to register a login. to set to cookie i use the following comand.
[PHP]
if (mysql_num_rows ($result) == 1)
{
setcookie("user ", $username, mktime()+604800 );
//echo '<pre>';
//var_dump($_COOK IE);
//echo '</pre>';
header("locatio n: ../index.php");
}
[/PHP]
when i uncomment the vardump my cookie is beign set
output from above when uncommented:
array(1) {
["user"]=>
string(1) "1"
}
but on the index.php page i cannot read the cookie. i don't know if i am doing somthing wrong but here is the code for index.php.
[PHP]
if ($_COOKIE["user"] != 1);
{
//header("locatio n: login.htm");
var_dump($_COOK IE);
}
[/PHP]
and it just displays
array(0) { }
so either the cookie isn't getting set properly of my method of reading it is incorrect.
thanks for help
eric
i am having an unusual and frustrating problem. i am trying to set cookies to register a login. to set to cookie i use the following comand.
[PHP]
if (mysql_num_rows ($result) == 1)
{
setcookie("user ", $username, mktime()+604800 );
//echo '<pre>';
//var_dump($_COOK IE);
//echo '</pre>';
header("locatio n: ../index.php");
}
[/PHP]
when i uncomment the vardump my cookie is beign set
output from above when uncommented:
array(1) {
["user"]=>
string(1) "1"
}
but on the index.php page i cannot read the cookie. i don't know if i am doing somthing wrong but here is the code for index.php.
[PHP]
if ($_COOKIE["user"] != 1);
{
//header("locatio n: login.htm");
var_dump($_COOK IE);
}
[/PHP]
and it just displays
array(0) { }
so either the cookie isn't getting set properly of my method of reading it is incorrect.
thanks for help
eric