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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.