Log Out Text Button...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
No0b
Forum Commoner
Posts: 37
Joined: Tue Feb 07, 2006 6:17 pm

Log Out Text Button...

Post by No0b »

I need some help with my php script. What i'm trying to do is have a clickable text that when clicked "onMouseClick" it logs out of your session. What I was thinking of doing was making a text that had the onMouseClick event that equals "$_SESSION[logged] = "" " but i don't know if it'll make the $_SESSION super = nothing and i don't know how to make a text clickable without making it a link. If there is any other way of making a log out text that makes the session end or the super ($_SESSION[logged]) eqaul nothing. I perfere the $_SESSION super global way but if there's a better way then that's best.

Thanks for reading and all help is appreciated. :) :D :o
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

why do you want it onclick?

i think it is better to kill the session on a logout page.
User avatar
No0b
Forum Commoner
Posts: 37
Joined: Tue Feb 07, 2006 6:17 pm

Post by No0b »

be cuz onclick is one of the only ways i could of thinked of instade of making a whole new page. and another thing is that i want it to refresh the page and if the page needs session access then it'll do it's thing.

If i made a whole page for loging out then i don't know i guess it's good. just andy suggessions are good just need it to log out when you click the text how ever any one else does this is good enough.
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

thats stupid though. just make a logout page with a header() so it redirects automatically to the login form or where ever you want.
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post by raghavan20 »

this should help...

Code: Select all

if (isset($_GET["action"])){
	if ($_GET["action"] == "logout"){
		unset ($_SESSION["logged"]);
		header ("Location: index.php");
	}
}

<a href = 'login.php?action=logout'>Log Out</a>
Post Reply