Monday, May 24, 2010

What is a Javascipt code to change text from login to logout if they are signed in?

What is a Javascipt code to change text from login to logout if they are signed in. or if there is any other type of code please tell me i really need it i cant find it.

What is a Javascipt code to change text from login to logout if they are signed in?
%26lt;script type="text/javascript"%26gt;


If ( logged.php == TRUE ) {


Logout


}


elseif ( logged.php == FALSE ) {


Login


}


else {


document.location = http://site.com/home.html


%26lt;/script%26gt;





This script would use a login script called logged.php, and when the script returned false, meaning nobody was logged in, it would display "Login" and if the script returned true, meaning that someone *was* logged in, it would display "Logout"
Reply:Its not javascript. Normally, only the server knows if a particular request is from someone logged in.





So when someone successfully logs in, you can create an object and put it in the session. If you can't find that session object on any page, the person is not logged in.





If you can, then just put "logout" in the text location.

flower arrangement

No comments:

Post a Comment