Jump to content

$_cookie[!]


asmith

Recommended Posts

hi

i'm studing php with a book

in a "login page" i put these lines :

if  ($num !=0)    \\  $num for mysql_num_rows which identied the user

{setcookie("aaa","bbb",time()+1800,"/","127.0.0.1",0);

$displayblock = "<a href=\"a.php\"> a page </a>";}

else {$displayblock = "your username and password do not match!";}

.

.

.

echo $displayblock ;

 

 

when i load this page and sign in i can see the a page link , but my browser do not warn me about recieving cookie (and no "eye" icon in the status bar (each IE 6 and FF 2))

 

and in a.php i have at the top :

if ($_COOKIE[aaa] == "bbb")

{$msg="hello !!!";}

else {header("location: /loginpage.html");

exit;

}

.

.

.

and when i click in a page link , it shows up the login page again which means $_COOKIE didn't worked...  please help !!!!

 

Link to comment
https://forums.phpfreaks.com/topic/77811-_cookie/
Share on other sites

f ($_COOKIE[aaa] == "bbb")

{$msg="hello !!!";}

else {header("location: /loginpage.html");

exit;

}

.

.

.

and when i click in a page link , it shows up the login page again which means $_COOKIE didn't worked

 

did u xpect $msg to display on clickin d page link..in tat case wher s the echo statement for $msg?

Also check your cookie settings for the browser.

 

 

Link to comment
https://forums.phpfreaks.com/topic/77811-_cookie/#findComment-393820
Share on other sites

does that make any diffrence?

at down of that page where $msg = "hello!"

in the body tag ,

<body>

<?php

echo $msg;

?>

...

 

i can't get it working don't know why , the book has written you browser should alert you about recieving a coockie, but i've got nothing, then again i've looked at IE option , i can't find cookie option , but in fire fox the option goes to cookie has checked , nothing wrong is with FF cookie option it is "allowed" .

what is it i'm doing wrong?

Link to comment
https://forums.phpfreaks.com/topic/77811-_cookie/#findComment-393829
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.