Reply LinkBack Thread Tools Search this Thread
Old 26-02-2004, 02:28   #1 (permalink)
crisjr
Registered User
 
Join Date: Feb 2004
Posts: 2
php logout (session) & html frames

hi php gurus,

i've been searching for a solution on how to logout a session login in a frame-based website. (i know frame is not much of pactice for today's web development, sorry if i bother to use frames)

premise:
1. index.php - pages w/ frames (4)
- checks if login session is set, if not redirect to login.php
---------------
---------------
| | |
| | |
---------------
---------------

2. login.php - login page is working, connects to db, sets login session, then redirect to index.php

3. logout.php - in the framed-pages after logging-in, i have a log-out link (this link is placed on the top frame). the logout page destroys/unset session, then *SHOULD* redirect the page to login.php (using php function: header(); ).

the behaviour of logout procedure is it redirects to login.php *ON* its frame window.

problem:
how do i redirect the logout to login.php, basically not on index.php frames


thanks in advance.

crisjr.
  Reply With Quote
Old 26-02-2004, 02:53   #2 (permalink)
smallbeer
I Ain't Losing Any Sleep™
 
Join Date: Apr 2003
Posts: 5,236
You'd have to use some kind of javascript I reckon. I haven't got time now but something like this in logout.php maybe?

<script type="text/javascript">
if(top!=self){
top.location=self.location;
}
</script>

I'm might have misunderstood your description though!

The simplest solution is to not use frames. php includes would do your job much easier and elegantly.
__________________
That's fuckin' ingenious, if I understand it correctly. It's a Swiss fuckin' watch.
  Reply With Quote
Old 26-02-2004, 04:43   #3 (permalink)
crisjr
Registered User
 
Join Date: Feb 2004
Posts: 2
thanks, the solution is javascript-php combination. i modified your suggestion to suit the system.

c",)
  Reply With Quote
Old 19-03-2004, 10:06   #4 (permalink)
DaiWelsh
Registered User
 
Join Date: Mar 2004
Location: Derby, UK
Posts: 24
Quote:
Originally Posted by crisjr
3. logout.php - in the framed-pages after logging-in, i have a log-out link (this link is placed on the top frame). the logout page destroys/unset session, then *SHOULD* redirect the page to login.php (using php function: header(); ).

the behaviour of logout procedure is it redirects to login.php *ON* its frame window.

problem:
how do i redirect the logout to login.php, basically not on index.php frames

You should just be able to set the target of the logout link to point to the top frame that way the logout page and then the following login page will load into that top frame. Best to avoid javascript when it is not strictly necessary.
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8