Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

php logout

 
   Database Forums (Home) -> PHP RSS
Next:  Course  
Author Message
King of Red Lions1

External


Since: Mar 07, 2004
Posts: 12



(Msg. 1) Posted: Thu Nov 04, 2004 4:35 pm
Post subject: php logout
Archived from groups: alt>php (more info?)

Hi I have an admin section to my site and was wondering, how can I
create a link that logs you out?

 >> Stay informed about: php logout 
Back to top
Login to vote
HawkEye1

External


Since: Oct 06, 2004
Posts: 4



(Msg. 2) Posted: Thu Nov 04, 2004 4:35 pm
Post subject: Re: php logout [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

King of Red Lions wrote:
 > Hi I have an admin section to my site and was wondering, how can I
 > create a link that logs you out?

Assuming you are using sessions for your authentication just call the
session_destroy() function when the logout button is clicked.

HTH

--
Regards

Neil

Registered Linux User 324599
Moore's Law: hardware speed doubles every 18 months - Gates' Law:
software speed halves every 18 months

 >> Stay informed about: php logout 
Back to top
Login to vote
King of Red Lions1

External


Since: Mar 07, 2004
Posts: 12



(Msg. 3) Posted: Thu Nov 04, 2004 6:23 pm
Post subject: Re: php logout [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

HawkEye wrote:
 > King of Red Lions wrote:
 >
  >> Hi I have an admin section to my site and was wondering, how can I
  >> create a link that logs you out?
 >
 >
 > Assuming you are using sessions for your authentication just call the
 > session_destroy() function when the logout button is clicked.
 >
 > HTH
 >

Okay, I'm a bit new to php, sorry. I have a link called logout, code
being logout what would I need to do to call the
session_destroy() function from there? By the way, yes I am using
sessions for my authentication.
 >> Stay informed about: php logout 
Back to top
Login to vote
Theo4

External


Since: May 02, 2004
Posts: 16



(Msg. 4) Posted: Thu Nov 04, 2004 7:22 pm
Post subject: Re: php logout [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

King of Red Lions wrote in
@news8.svr.pol.co.uk:

 > HawkEye wrote:
  >> King of Red Lions wrote:
  >>
   >>> Hi I have an admin section to my site and was wondering, how can I
   >>> create a link that logs you out?
  >>
  >>
  >> Assuming you are using sessions for your authentication just call the
  >> session_destroy() function when the logout button is clicked.
  >>
  >> HTH
  >>
 >
 > Okay, I'm a bit new to php, sorry. I have a link called logout, code
 > being logout what would I need to do to call the
 > session_destroy() function from there? By the way, yes I am using
 > sessions for my authentication.
 >

just my opinion, have your logout link simply go to a new page with the
php needed, and a thank you in the html portion.
 >> Stay informed about: php logout 
Back to top
Login to vote
steve




Joined: Jan 06, 2004
Posts: 660



(Msg. 5) Posted: Thu Nov 04, 2004 8:57 pm
Post subject: Re: php logout [Login to view extended thread Info.]

HawkEye1 wrote:
King of Red Lions wrote:
> Hi I have an admin section to my site and was wondering, how can I
> create a link that logs you out?

Assuming you are using sessions for your authentication just call the
session_destroy() function when the logout button is clicked.

HTH


Most likely you also have a cookie (?), and then you may want to destroy the cookie on logout. So you can read about that elsewhere, but essentially you set the expiration date to sometime in the past to make that happen.
 >> Stay informed about: php logout 
Back to top
Login to vote
HawkEye1

External


Since: Oct 06, 2004
Posts: 4



(Msg. 6) Posted: Fri Nov 05, 2004 6:21 pm
Post subject: Re: php logout [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Theo wrote:

  >>
  >>Okay, I'm a bit new to php, sorry. I have a link called logout, code
  >>being logout what would I need to do to call the
  >>session_destroy() function from there? By the way, yes I am using
  >>sessions for my authentication.
  >>
 >
 >
 > just my opinion, have your logout link simply go to a new page with the
 > php needed, and a thank you in the html portion.

Agreed, that way you can not only destroy the session but you can (as
another poster pointed out) destroy any cookies you may have and also unset
any global variables you may be using.

If you need any examples have a search around <a rel="nofollow" style='text-decoration: none;' href="http://www.phpbuilder.com" target="_blank">www.phpbuilder.com</a> code
library section or (possibly better for tutorials) <a rel="nofollow" style='text-decoration: none;' href="http://www.devshed.com/c/b/PHP#/" target="_blank">www.devshed.com/c/b/PHP#/</a>

Enjoy php - it is a fun language, post back if you need more help.

--
Regards

Neil

Registered Linux User 324599
Linux is based entirely on the ancient principle of WYGIWYGAINGW*
________________
*) 'What You Get Is What You're Given And It's No Good Whining' (after
Terry Pratchett)
 >> Stay informed about: php logout 
Back to top
Login to vote
ScareCrowe

External


Since: Oct 18, 2003
Posts: 24



(Msg. 7) Posted: Sat Nov 06, 2004 1:55 am
Post subject: Re: php logout [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"HawkEye" wrote in message

 > Theo wrote:
 >
   > >>
   > >>Okay, I'm a bit new to php, sorry. I have a link called logout, code
   > >>being logout what would I need to do to call the
   > >>session_destroy() function from there? By the way, yes I am using
   > >>sessions for my authentication.
   > >>

I use the same page for logging in and out, the URL passed is basically href="login.php?logout=true">logout

and on the page something like;

if(isset($logout)){
session_destroy();
echo Thanks, it was great;
blah blah blah
}

-ScareCrowe




----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
<a rel="nofollow" style='text-decoration: none;' href="http://www.newsfeeds.com" target="_blank">http://www.newsfeeds.com</a> The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
 >> Stay informed about: php logout 
Back to top
Login to vote
Theo4

External


Since: May 02, 2004
Posts: 16



(Msg. 8) Posted: Sat Nov 06, 2004 4:23 pm
Post subject: Re: php logout [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"ScareCrowe" wrote in

 >


  >> Theo wrote:
  >>
   >> >>
   >> >>Okay, I'm a bit new to php, sorry. I have a link called logout,
   >> >>code being logout what would I need to do to call
   >> >>the session_destroy() function from there? By the way, yes I am
   >> >>using sessions for my authentication.
   >> >>
 >
 > I use the same page for logging in and out, the URL passed is
 > basically logout
 >
 > and on the page something like;
 >
 > if(isset($logout)){
 > session_destroy();
 > echo Thanks, it was great;
 > blah blah blah
 > }
 >
 > -ScareCrowe

Another reason to have a seperate page is so you can put a logout link on
every page there is. The page does its thing, then automatically
redirects to another non-secure page.

But yea, always more than one way to skin a cat... if that term isnt too
anti-PC nowdays Razz
 >> Stay informed about: php logout 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
how to automatically logout users from my site - hello. I'm building a site using php I have a setup.php page wich has at the begining session_start(); and every single page from my site includes setup.php. When a user registers I save in $_SESSION["Login"] the userName, so that when !..

json and special chars - Hi! In my DB table I've chars like עטלש but when I generate json file I show \u00e0\u00f2\u00e8\u00ec\u00f9 is it right this change in my char? Thanks

Simple question?? PHP..ODBC..and...dBASE - Ok this may be a dumb question to some but for the first time this evening I have to access dBASE file through ODBC.. I'm trying to do simple queries of SELECT * FROM ??? however I can't for the life of me figure out what to put in place of the ???. Any....

PHP for Dummies (Me being the dummy) - Maybe it is just cos it is Friday and my head is already gone away for the weekend but I just cannot get sessions working! Anyway - two pages. Page one starts session and registers a sesison variable, Page 2 tries to then print out the session..

online reference to mysql_errno() codes? - I want to do something like this: while(false == ($result = mysql_query($query)) ) { switch(mysql_errno()) { case $fixableError[0]: case $fixableError[1]: /* fix the errors */ break; default: die..
   Database Forums (Home) -> PHP All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]