Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Apache
Author Message
Darrell3831
Worker
Worker



Joined: Feb 18, 2004
Posts: 244

PostPosted: Sat Feb 18, 2006 8:44 am Reply with quote

How do you pass a server variable out of the .htaccess file into your script?

This dosent work:

Code:
ErrorDocument 404 /modules.php?name=404_Error&uri=%{ENV:REQUEST_URI}


I'm trying to pass the requested URI that generated a 404 error to my .php script to proccess the error.

I cannot do this in the .php file because the environment variables are not the actual ones that caused the 404 in the first place.

Code:
if ($notify_admin==1) {

   $subject = "404 Error Report";
   $mailheaders  = "From: $from\n";
   $mailheaders .= "Reply-To: $to\n\n";

   $ip = $_SERVER['REMOTE_ADDR'];
   $requri = $_SERVER['REQUEST_URI'];
   $servname = $_SERVER['SERVER_NAME'];
   $httpref = $_SERVER['HTTP_REFERER'];
   $httpagent = $_SERVER['HTTP_USER_AGENT'];

   $combine = "IP: ". $ip . " tried to load " . $servname . $requri ;
   $today = date("D M j Y g:i:s a T");

   $message = "$today \n
   $combine \n
   User Agent = $httpagent \n
   $httpref \n
   "._404_TURNOFF."\n";

   mail($to, $subject, $message, $mailheaders);
}


So, I must catch them in the .htaccess file and pass them to my .php file, but I don't know how.

Thanks,
Darrell

_________________
[ Only registered users can see links on this board! Get registered or login! ] 
View user's profile Send private message Visit poster's website
Guardian2003
Site Admin



Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam

PostPosted: Sat Feb 18, 2006 3:56 pm Reply with quote

Try changing
Code:
$requri = $_SERVER['REQUEST_URI']; 
to
Code:
$requri = getenv ("REQUEST_URI");
 
View user's profile Send private message Send e-mail
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Apache

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©