Skip to content

Instantly share code, notes, and snippets.

@jjok
Last active December 14, 2015 00:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jjok/4997313 to your computer and use it in GitHub Desktop.
Save jjok/4997313 to your computer and use it in GitHub Desktop.
PHP Localhost homepage.
<?php
/**
* Copyright (c) 2013 Jonathan Jefferies
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
?>
<!DOCTYPE html>
<html lang="en-GB">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title><?php echo $_SERVER['HTTP_HOST']; ?></title>
<style>
html { font:100 20px/1.3em "Segoe UI Light", "Segoe UI", "HelveticaNeue-UltraLight", Tahoma, sans-serif; }
body { margin:0 1em 0 0; }
h1, h2 { font-weight:100; text-shadow:0 0 0.5em rgba(0, 0, 0, 0.6); }
h1 { margin:1em 0.5em; font-size:2.5em; line-height:1.3em; }
section { margin:2em 0; padding:2em; width:90%; background-color:#DDD; }
section h1 { margin:0 0 0.5em; font-size:2em; line-height:1.3em; }
section h2 { font-size:1.5em; line-height:1.3em; }
footer { text-align:right; font-size:0.5rem; color:#777; }
footer a { color:#777; text-shadow:0 0 0.5em rgba(0, 90, 137, 0.8); text-decoration:none; }
#php-extensions { margin:0; padding:0; list-style:none; -moz-column-width:10em; -webkit-column-width:10em; column-width:10em; text-transform:lowercase; }
</style>
</head>
<body>
<h1><?php echo $_SERVER['HTTP_HOST']; ?></h1>
<section>
<h1>Projects</h1>
<ul>
<?php for($it = new \FilesystemIterator('./', \FilesystemIterator::SKIP_DOTS); $it->valid(); $it->next()) { ?>
<?php if($it->isDir() && strpos($it->getFilename(), '.') !== 0) { ?>
<li><a href="<?php echo $it->getFilename(); ?>"><?php echo $it->getFilename(); ?></a></li>
<?php } ?>
<?php } ?>
</ul>
</section>
<section id="php">
<h1>PHP version: <?php printf('%d.%d.%d', PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION); ?></h1>
<h2>Loaded extensions</h2>
<ul id="php-extensions">
<?php for($extensions = get_loaded_extensions(),
natcasesort($extensions),
$extensions = array_values($extensions),
$n = 0, $l = count($extensions); $n < $l; $n++) { ?>
<li><?php echo $extensions[$n]; ?></li>
<?php } ?>
</ul>
</section>
<footer>
<address>developed by <a href="http://jjok.co.uk" title="Jonathan Jefferies">Jonathan Jefferies</a></address>
</footer>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment