Skip to content

Instantly share code, notes, and snippets.

@jdunk
Created July 6, 2014 17:35
Show Gist options
  • Save jdunk/dea3913179c0cc78620e to your computer and use it in GitHub Desktop.
Save jdunk/dea3913179c0cc78620e to your computer and use it in GitHub Desktop.
Default index.php page
<?php
$output = exec('host ' . $_SERVER['REMOTE_ADDR']);
if (preg_match('@domain name pointer (.+)@', $output, $matches))
$output = $matches[1];
?>
<!doctype html>
<html>
<head>
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, width=device-width" />
<title><?= $_SERVER['HTTP_HOST']; ?></title>
<style>
*, *:after, *:before { box-sizing: border-box }
body
{
}
#main
{
text-align: center;
margin: 10px auto 0;
background: #ddd;
border: 1px solid #222;
border-radius: 10px;
box-shadow: 10px 10px 40px -15px rgba(0,0,0,0.7);
-webkit-box-shadow: 10px 10px 40px -15px rgba(0,0,0,0.7);
padding: 15px;
max-width: 620px;
}
#main header
{
background-color: #f6f6f6;
padding: 2px;
border-radius: 3px;
font-size: 0.8em;
color: #333;
margin: 25px 0 5px 0;
}
#main header:nth-of-type(1)
{
margin-top: 0px;
}
#main div
{
font-weight: bold;
color: #000;
font-size: 1.7em;
font-family: "Lucida Console, Monaco, Courier New";
}
#main div:not(:first-of-type)
{
font-size: 1.1em;
color: #048;
}
</style>
</head>
<body>
<?= $_SERVER['HTTP_HOST']; ?>
<section id="main">
<header>Your IP</header>
<div><?= $_SERVER['REMOTE_ADDR'] ?></div>
<header>Your host</header>
<div><?= $output ?></div>
</section>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment