PHP/Development/Client Info — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 10:37, 26 мая 2010
Содержание
Http Host
<?php
echo "<PRE>";
echo "<BR><B>Host :</B> $HTTP_HOST";
echo "</PRE>";
?>
Http Referer
<?php
echo "<PRE>";
echo "<BR><B>Referer :</B> $HTTP_REFERER";
echo "</PRE>";
?>
Is user using the Miscrosoft Internet Explorer
<?
$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";
}
?>
The name and version of the client
<?
$agent = getenv("HTTP_USER_AGENT");
echo " You are using $agent.";
?>
Using gethostbyaddr() to Get a Hostname
<html>
<head>
<title>Using gethostbyaddr() to get a host name</title>
</head>
<body>
<?php
if ( isset( $REMOTE_HOST ) )
print "Visitor at $REMOTE_HOST<br>";
elseif ( isset ( $REMOTE_ADDR ) )
print "Visitor at ".gethostbyaddr( $REMOTE_ADDR )."<br>";
else
print "wherever you are<br>";
?>
</body>
</html>