I wish a PHP code stops when condition is checked, generating a 401 Authorization Error (and so displaying the standard 401 error page).
How to ?
I wish a PHP code stops when condition is checked, generating a 401 Authorization Error (and so displaying the standard 401 error page).
How to ?
Not sure if this is what you mean, but... Sorry, but I am having a difficult time understanding your broken English, so you may need to give a better explanation.
IF(condition == true){
header("Location: ./401.php"); // Send them to the 401.php page
} else {
// Do something else
}
I think I might have something to add. If you were looking for the header to redirect someone to an actual 401 error page...
header ( "HTTP/1.0 401 Unauthorized" );
That'll call up a 401 Error, just like it might a 404 error. I think...yes...that's...no...wait maybe...
Thanku Zib, that's what I meant
After reading the php manual, I see 2 headers are required:
header('WWW-Authenticate: Basic realm="Test Authentication System"');
header('HTTP/1.0 401 Unauthorized');
This forces a 401-error directly managed by the webserver: what I wanted!
Thanku
sniffles Won't you please mark it resolved through that link at the bottom? It's all we get around here... sobs