alexfung Posted October 7, 2003 Posted October 7, 2003 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? Quote
surefire Posted October 7, 2003 Posted October 7, 2003 <?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. Quote
alexfung Posted October 8, 2003 Author Posted October 8, 2003 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? Quote
alexfung Posted October 8, 2003 Author Posted October 8, 2003 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? Quote
surefire Posted October 8, 2003 Posted October 8, 2003 My knowledge of playing with .htaccess is limited. Maybe you should send a support ticket. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.