WordPress Code Snippets

A fresh mix of code snippets and tutorials

Display PHP + server info

65

Quick snippet today meant as a copy/paste template for displaying your PHP and server information in the blink of an eye.

<? // display PHP + server infos
$ip_address   = $_SERVER['REMOTE_ADDR'];
$host_address = gethostbyaddr($ip_address);
$user_agent   = $_SERVER['HTTP_USER_AGENT'];
$referrer     = $_SERVER['HTTP_REFERER'];

echo "<p><strong>IP address:</strong> " . $ip_address . "</p>" . "\n";
echo "<p><strong>Host address:</strong> " . $host_address . "</p>" . "\n";
echo "<p><strong>User agent:</strong> " . $user_agent . "</p>" . "\n";
echo "<p><strong>Referrer:</strong> ";

if ($referrer == "") {
	echo "[ no referrer ]" . "</p>";
} else {
	echo "$referrer" . "</p>";
} ?>

Show Support

Like our new Facebook Page to show support!