404, grab the url missing?
Posted: Tue Aug 19, 2003 2:20 pm
I've made a 404 Not found page, (404.php)
I. trying to get the url they request to show up on the page. like The resource you have requested (http://w2r.net/AnErrorUrl.html) does not exist.
But its just grabbing the url to the 404.php file, and not the url that was missing. e.g. The resource you have requested (http://w2r.net/error/404.php) does not exist.
is my code wrong maybe? I'm kind empty of ideas on how to make it work.. any ideas?
Here is a complete view of the source "404.php"
I. trying to get the url they request to show up on the page. like The resource you have requested (http://w2r.net/AnErrorUrl.html) does not exist.
But its just grabbing the url to the 404.php file, and not the url that was missing. e.g. The resource you have requested (http://w2r.net/error/404.php) does not exist.
Code: Select all
The resource you have requested (<strong>http://w2r.net<?= $_SERVERї'REQUEST_URI'] ?></strong>) does not exist.Here is a complete view of the source "404.php"
Code: Select all
<?
# Some variables for the log
$now = gmdate('Y-m-d H:i:s');
$ip_address = gethostbyaddr($_SERVERї'REMOTE_ADDR']);
$requested_page = str_replace('|', '|', $_SERVERї'REQUEST_URI']);
$referer = $_SERVERї'HTTP_REFERER'];
# let's write this information to a local file
$fp = fopen("/hsphere/local/home/w2rnet/w2r.net/error/404log.txt", "a+");
fputs($fp, $now .' |'. $ip_address .' |'. $referer .' |'. $requested_page ."\n");
fclose($fp);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>404 - File not found.</TITLE>
<link rel="stylesheet" href="../demo/style.css" type="text/css" />
</head>
<body>
<div align="center">
<p><br> </p>
<table width="80%" border="0" cellspacing="4" cellpadding="4">
<tr>
<td colspan="2" valign="bottom">
<div class="title">
<center>404. File not found.</center>
</div>
</td>
</tr>
<tr>
<td colspan="2">
The resource you have requested (<strong>http://w2r.net<?= $_SERVERї'REQUEST_URI'] ?></strong>) does not exist. It has never existed. Any suggestion to the contrary is nothing but the scandalous lie of a greasy weavil-eating snot-monkey.<br>
<br>
There is no use in crying about it. I'm as upset about the whole thing as you are.
There's nothing to be gained by pointing fingers and giving voice to wild accusations about who moved what directory where, or who renamed this file that.
Suffice it to say that whatever it is you're looking for won't be found by way of here.<br>
<br>
There is always hope: you may simply have mistyped the address. Feel free to take another stab at it. You'll probably end up here again though, so don't say I didn't warn you.<br>
<br>
You can explore the <a href="http://www.w2r.net/">site map</a>, or you can just return <a href="javascript:history.go(-1)">whence you came</a>.
</td>
</tr>
</table>
</div>
</body>
</html>