WP-Mix

A fresh mix of code snippets and tutorials

Display PHP + server info

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>";
} ?>

★ Pro Tip:

USP ProSAC Pro