This is going to be a silly question. I have written the following form to mail 
script, and it works. But it takes a good minute or so to process. Can any one shed 
some light?

I think it may have to do with the gethostbyaddr($REMOTE_ADDR) but if anyone else can 
help, that would be great.

Jon


<?php

if ($REQUEST_METHOD !="POST"){

 echo "<h1>Something unexpected happened</h1><br><br>User: There is nothing you can 
do<br>";
 echo "<br>Webmaster: You can only call this script with 'POST'";

} else {

 $datevar = date("F j, Y");
 $timevar = date("g:i a T");                 
 $message .= "The following message was received from $HTTP_REFERER\non $datevar at 
$timevar\n\n";

 if ($incall!=""){
  $allvars = explode(",",$incall);
   $incto = $allvars[0];
   $incsubject = $allvars[1];
   $incurl = $allvars[2];
   $incfrom = $allvars[3];
   $incinfo = $allvars[4];
 }
 
 if ($incinfo > 0 ){
  $message .= "User's IP Address: $REMOTE_ADDR\n";
 }

 if ($incinfo > 1 ){
  $message .= "User's Browser: $HTTP_USER_AGENT\n";
 }

 if ($incinfo > 2 ){
  $resolvedhost = gethostbyaddr($REMOTE_ADDR);
  $message .= "User's Host Name: $resolvedhost\n";
 }
  $message .= "\n";
 
 while(list($key,$val)=each($HTTP_POST_VARS)) {

  //DO NOT PRINT SYSTEM VARIABLES
  if(($key=="incto")  ||($key=="incsubject")||($key=="incurl")||($key=="incfrom")){
  }elseif(($key=="incinfo")||($key=="incall")){

  //PRINT ALL OTHER VARIABLES
  }else{
  $message .= "$key:     $val\n\n";
  }
  
 }

 if ($incto==""){
  echo "<h1>Something unexpected happened</h1><br><br>User: There is nothing you can 
do<br>";
  echo "<br>Webmaster: You did not specify an e-mail address to receive this message";
 }

 if ($incfrom==""){
  $incfrom = "From: jcMail@$SERVER_NAME";
 } else {
  $incfrom = "From: $incfrom";
 }

 if ($incsubject==""){
  $incsubject = "Message from jcMail: $datevar $timevar";
 }

 if ($incurl==""){
  $incurl = "$HTTP_REFERER";
 }
 
 $message .="=--\nThis message brought to you by jcMail!";

 mail("$incto", "$incsubject", $message, "$incfrom");
 echo "<html><head><title>Sending...</title>";
 echo "<META HTTP-EQUIV='refresh' content='0;URL=$incurl'></HEAD><BODY>";
 echo "Your message has been sent<br><a href='$url'>If you are not automatically 
redirected, click here</a>";

}
?>

Reply via email to