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"

Link to comment
Share on other sites

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 >_<

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.