Jump to content

Recommended Posts

Posted

I did a <?php echo $_SERVER['REMOTE_HOST'] ?>. Returns empty.

 

Then I copied an example from PHP manual:

<?php

$headers = apache_request_headers();

 

foreach ($headers as $header => $value) {

echo "$header: $value <br />\n";

}

?>

 

no REMOTE_HOST line. no Remote_ADDR line.

 

How does the PHP_INFO list REMOTE_HOST?

 

By the way, can I check REMOTE_HOST in .htaccess RewriteCond?

Posted
<?php

$a=$HTTP_SERVER_VARS;

foreach($a as $key=>$val)

{

print("$key=>$val<br>");

}

?>

 

Will show you everything you want... pick the variable that interests you most.

Posted

Thanks for the code. I got REMOTE_ADDR, but not REMOTE_HOST. OTOH, the

 

http://www.totalchoicehosting.com/help/info.php

 

correctly listed my REMOTE_HOST under Apache Environment. How is it possible?

 

 

An unrelated question. I have turned on notifications, and set the correct email address. However, I never got any notifications. Is there something wrong?

Posted

I solved my posted question:

 

<?php echo gethostbyaddr($_SERVER['REMOTE_ADDR']) ?>

 

However, I failed to do similar things in .htaccess. Textbook examples have

 

RewriteCond %{REMOTE_HOST} ...

 

but does not work (because it is always null). Why?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...