Hi,

        I'm not sure if this is going to help or not.. Since I understand
your issue only barely.. If I understand correctly, regardless of whether
the user comes from a.php, b.php or z.php, if they're not authenticated on
the system (via sessions or cookies) then the only place for them to go is
login.php. RIGHT???

Here's my 2 cents. (part of code I'm working on)


=========login.php===============
if ( check_if_authenticated() )   <--- I have this fucntion located at the
top of a.php,b.php,c.php
{
        header_refresh_html("home.php");  <--- Function call -> back to
Home.php if logged in
        exit;
}
else            <--- display login form is not already logged in
{
        top_html();                             
        display_welcome_msg_html();
}
==================================

===============html_functions.php ==========
# ===========================
# This is where I print headers to redirect pages
# Default wait time is 2 seconds
# NOTE : WE MUST PRINT THE REDIRECTION BEFORE WE OUTPUT ANYTHING!
#        Just put the redirection BEFORE the outputs!
# ===========================
function header_refresh_html($l_refresh_url) <--- the page to redirect to is
given as an argument
{
        // This is taken from php-manual
        header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// Date in the past
        header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");  //
always modified
        header("Cache-Control: no-store, no-cache, must-revalidate");   //
HTTP/1.1
        header("Cache-Control: post-check=0, pre-check=0", false);
        header("Pragma: no-cache");
// HTTP/1.0
        
        header( "Refresh:2;url=$l_refresh_url" );               // Wait
default of 2 seconds
}

function header_redirect_html($l_redirect_url)
{
        header( "Location:$l_redirect_url");                    // Instant
Redirection
}

=========================================




Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia 
DID : 03-7870 5168


-----Original Message-----
From: Beauford.2005 [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 24, 2003 8:55 AM
To: 'PHP'
Subject: RE: [PHP] Redirection Question


Thanks to all, I got it working - sort of. It works perfectly on
Windows, but will not work on Linux. I am using the same versions of
PHP, Apache and MySQL on both. I have asked this before and have been
told they are interchangeable, but more times than not I have to make a
bunch of changes to get it to work on Linux - and this is just another
example. I use Windows to do all the coding and design as it has all the
tools. Linux is just a bare bones box with no gui or tools. The php.ini
and httpd.conf are the same on both platforms (other than what is needed
for the specific platform). This makes it a real pain.

Oh well, back to my debugging.


-----Original Message-----
From: Curt Zirzow [mailto:[EMAIL PROTECTED] 
Sent: July 22, 2003 7:04 PM
To: PHP
Subject: Re: [PHP] Redirection Question


* Thus wrote Beauford.2005 ([EMAIL PROTECTED]):
> Maybe I didn't explain enough. What if they come from b.php or c.php. 
> How do I automatically log what page they tried to access. So hard 
> coding login.php?next=a.php would only work for one page.

Use the code that Grant Rutherford posted earlier, its the same concept
just a whole lot more flexible than mine. Not to mention a bit more
secured.

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

-- 
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

Reply via email to