;

PDA

Click to See Complete Forum and Search --> : Retrieving data from a cookie


fido_glc
05-27-2009, 06:29 PM
Hello.

I have a problem with using a cookie in Flash and I need some help. I don't know too much about cookies so I am looking forward to your help.

What I need is to retrieve the username from a cookie into Flash. I am using LoadVars to communicate with a PHP file that will echo the username.

The problem is with the PHP file that should output the username from the cookie.

Here is the simple PHP code that I have tried:

$user = $_SESSION['username'];
echo "user=".$user;


I have also tried the following:

$user = $_COOKIE['username'];
echo "user=".$user;


Are any of these correct ? Is there anything else that I need to do ? I am sure that it is something rather simple in the end.


Again, what the PHP code needs to do is retrieve the username with the id of "username" from a cookie.


Thank you.

fido_glc
05-28-2009, 11:53 AM
Any ideas ?

sstalder
05-28-2009, 01:32 PM
Well if it's a cookie then you can use:

$user = $_COOKIE['username'];
echo "&user=".$user;

If it's a session, then use a session. Cookies and sessions are two completely different things.

Whats the flash code you are using?