...

View Full Version : Cause 403 error using PHP



anshul
06-18-2005, 08:51 AM
How to cause 403 error using PHP?

I used this to create 401 error in members' only Web pages.
<?php
header('HTTP/1.0 401 Unauthorized');
?>

Fou-Lu
06-18-2005, 03:23 PM
For 403:


header("HTTP/1.0 403 Forbidden");


If you have access to .htaccess files, you'd be better off controlling output that way.
This will mearly create the page, it will not validate for any security (alone that is).

think123
06-10-2011, 05:43 AM
Thanks Fou-Lu, but i tried that on my host and it didn't actually work, so any other way? :confused::confused::confused: Thanks!! :):):)

th90
09-28-2011, 11:36 AM
Hi.
I have an authorization required page created with php.
I want to do this: if the login fails, the page will show the 403 http error.
How to use php to show 403 http error page?
the code:
header('HTTP/1.1 403 Forbidden');
does not work.
Is it possible to use "Include" to show the error 403?

th90
09-28-2011, 12:44 PM
I did this :
a file with name: 403.php:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access <?php
echo $_SERVER['SCRIPT_NAME'];
?> on this server.</p>
<p>Additionally, a 403 Forbidden
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>

and an "include" like this:

include('403.php');
exit;



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum