Re: Sessions question
| From: | Kevin Stone | Date: | Fri, 21 Mar 2003 21:21:26 +0000 |
| Subject: | Re: Sessions question | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-140637@lists.php.net to get a copy of this message | ||
This is one of those rare things in programming that can only be done one
way. Absolutely the only way to kill the session when a user leaves your
site is to go through a script and then redirect after the session has been
destroyed. For this to work every outgoing link on your website will have
to point to a script. Then you'll pass the redirect url or url id (that
referse to a url in your database) through the link and redirect after
session_destroy() has killed the session.
The link can look like this:
<a href="exit.php?url=http://www.thiersite.com">www.theirsite.com</a>
The script will look something like this:
<? // exit.php
session_start();
session_destroy();
header("Location: ".$_POST['url']);
?>
Keep in mind if you want to do this then the user will not be able to use
his/her back button in order to return to your website unless you define an
additional redirect in a conditional that states "if the session is not
active then go here".
Voodoo. *LOL*
- Kevin
----- Original Message -----
From: "Beauford.2002" <beauford.2002@rogers.com>
To: "Ford, Mike [LSS]" <M.Ford@lmu.ac.uk>; "'Justin French'"
<justin@indent.com.au>; "PHP General" <php-general@lists.php.net>
Sent: Friday, March 21, 2003 12:56 PM
Subject: Re: [PHP] Sessions question
> So is there anyway to do this - perl, javascript, voodo?
>
>
> ----- Original Message -----
> From: "Ford, Mike [LSS]" <M.Ford@lmu.ac.uk>
> To: "'Justin French'" <justin@indent.com.au>;
> "Beauford.2002"
> <beauford.2002@rogers.com>; "PHP General" <php-general@lists.php.net>
> Sent: Friday, March 21, 2003 11:04 AM
> Subject: RE: [PHP] Sessions question
>
>
> > > -----Original Message-----
> > > From: Justin French [mailto:justin@indent.com.au]
> > > Sent: 21 March 2003 15:59
> > >
> > > on 22/03/03 2:27 AM, Beauford.2002 (beauford.2002@rogers.com) wrote:
> > >
> > > > What about cookies - someone said if you put no time limit
> > > on a cookie it
> > > > dies when you leave the site - I'm not sure about this, but
> > > any help is
> > > > appreciated.
> > >
> > > I think it's defined as "when the browser is closed", not
> > > "when the browser
> > > is no longer in your domain"
> >
> > That is correct.
> >
> > Cheers!
> >
> > Mike
> >
> > ---------------------------------------------------------------------
> > Mike Ford, Electronic Information Services Adviser,
> > Learning Support Services, Learning & Information Services,
> > JG125, James Graham Building, Leeds Metropolitan University,
> > Beckett Park, LEEDS, LS6 3QS, United Kingdom
> > Email: m.ford@lmu.ac.uk
> > Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>