Jump to content

Problem with retrieving info from a cookie


xcali

Recommended Posts

hey guys

 

i have a problem with retrieving information from a cookie

 

the part of my login script creates a cookie with the following:

...
// if login is ok then we add a cookie
$_POST['username'] = stripslashes($_POST['username']);
$hour = time() + 3600;
setcookie(username, $_POST['username'], $hour);
setcookie(Key_JDW, $_POST['pass'], $hour);
...

 

then a script should retrieve the username from the cookie:

the code i use it as follows:

	
<?php   
echo 'Welcome to JDW'  .$_COOKIE['username']. '!';
?>

 

i only see ' Welcome to JDW! '

Am i doing something wrong?

i tried to do " " instead of ' '

i tried both "" ''

i tried {$_COOKIE['username']} and such but nothing seems work

can it be a problem with the way i created the cookie?

 

edit: i should probably mention that the username they use is their email, when i open the cookie its displayed as "something%40something.com"

yes

i tried in both internet explorer and Firefox and in both i get the  same thing... nothing

i cleared everything and logged in - cookie was created and when i view the content, it is exactly what i would like to have displayed

I have been trying to to fix this problem for the past 2 days >_<

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.