Forum Moderators: coopster
I wanted to do an http redirect if the user's authentication had failed:
$NewPage = 'login';
if(!authenticated() ) {
$NewURL = preg_replace( "[\w+(?=\.php)]", $NewPage, $_SERVER[ "SCRIPT_URI" ] );
header( "location: $NewURL\r\n" );
}
else
do something...
'login.php' must reside at the end of that same path as you're slipping it in the place of the original file name via the preg_replace().
Seeing as the two files are residing in the same directory, just enter login.php in the meta refresh, it will redirect to that file if (!authentication()).
T