PHP/Development/Client Info

Материал из Web эксперт
Перейти к: навигация, поиск

Http Host

   <source lang="html4strict">

<?php

echo "
";
  echo "<BR><B>Host          :</B> $HTTP_HOST";
  echo "
";

?>


      </source>
   
  


Http Referer

   <source lang="html4strict">

<?php

echo "
";
  echo "<BR><B>Referer       :</B> $HTTP_REFERER";
  echo "
";

?>


      </source>
   
  


Is user using the Miscrosoft Internet Explorer

   <source lang="html4strict">

<? $agent = getenv("HTTP_USER_AGENT"); echo($agent); if (preg_match("/MSIE/i", $agent)) {

    $result = "You are using Microsoft Internet Explorer.";

}else {

    $result = "You are using $agent";

} ?>

      </source>
   
  


The name and version of the client

   <source lang="html4strict">

<? $agent = getenv("HTTP_USER_AGENT"); echo " You are using $agent."; ?>


      </source>
   
  


Using gethostbyaddr() to Get a Hostname

   <source lang="html4strict">


<html> <head> <title>Using gethostbyaddr() to get a host name</title> </head> <body> <?php if ( isset( $REMOTE_HOST ) )

   print "Visitor at $REMOTE_HOST
";

elseif ( isset ( $REMOTE_ADDR ) )

   print "Visitor at ".gethostbyaddr( $REMOTE_ADDR )."
";

else

   print "wherever you are
"; ?>

</body> </html>


      </source>