[phplib] Redirect From: Jim Ide (JIde <email protected>)
Date: 08/23/00

I have a PHP4 application that uses PHPLIB 7.2c.
Each PHP script has require("pageopen.php") as the first
line of each script. The pageopen.php file has the
page_open() function as the first line, followed by
code that retrieves the date the user most recently
changed his/her password (this date is stored in a
MySQL table). If the user has NOT changed his/her
password in X days, I want the app to display a form
that prompts the user for his old password and his new
password; otherwise, the "change password" form
should NOT be displayed.

I initially had the pageopen.php file set up something
like this:

/******* beginning of pageopen.php ************/
page_open(array("sess" => "My_Session", "auth" => "My_Auth"));
$Username = $auth->auth["uname"];
$DaysSinceLastPasswordChange = CalcDaysSinceLastPasswordChange($Username);
if ( $DaysSinceLastPasswordChange > 30 ) {
        header("Location: " . $sess->url("chpasswd.php"));
}
/*********** end of pageopen.php ***************/

Since page_open() writes header info, the header() call
generates an error message.

How can I redirect (or otherwise branch) to another script after a user has
already logged in?

Thanks -
Jim

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>