Viper Creations
Comeback Contest
Check out our forums for the an explosive comeback contest. We are giving away everything from iPods to Visual Studio. more...
»User: »Password:   Remember Me? 
Webmaster Forum - Viper Creations / Viper Creations / Tutorials / FLEX login + session variable
Posted:  06 Mar 2007 21:58
Amazing tutorial...quick follow up with the flex login.  Is there a way to tie in a session variable into the login system?  So that, lets say...you want your user to be able to write a comment or something....the variable would be able to identify who made that comment. I was thinking that you could pass the session variable created with the php script back in the xml that is returned to the flex application.  Any ideas?

Thanks again for a really well written tutorial!

W
Posted:  07 Mar 2007 11:56   Last Edited By: danielneri
Well what I have done in an extended version of the login system is create a cookie right before the php script outputs "yes".

Code:

if(!$result)
{
    $Return .= "no";       
}else{
    setcookie("name_of_cookie","username,time()+604800,"/");
   
    $Return .= "yes";   
}


Hope that helps!
__________________
http://www.vipercreations.com/images/banner/result.gif
Posted:  08 Mar 2007 19:22
That points me in the right direction...I am still confused as to how to incorporate this cookie into Flex however.  Is there a way you could show a simple example of how to use the cookie in Flex?  Am I on the right track if I try to create a public variable and assign it the value from the cookie?

Thanks again!!!

W
Posted:  10 Mar 2007 13:21
Walrus,

What I did is have an httpservice that is run at the start which points to a php file which then checks if a cookie is set

Code:


if(isset($_COOKIE['username']))
{
echo '<cookie>yes</cookie>';
}else{
echo '<cookie>no</cookie>';
}


then flex checks the result and does whatever action is the result is true or false.

I know it's a bad explanation but I'm in a hurry, tell me if you don't get it and ill explain in further detail
__________________
http://www.vipercreations.com/images/banner/result.gif