All pastes #472628 Raw Edit

82 [lucas]

public php v1 · immutable
·published 2007-05-05 18:52 UTC
rendered paste body
<?php$time_start = microtime_float();ob_start();session_start();$page = array();foreach($_GET as $key => $value) $page[] = htmlentities(stripslashes($key));// allowed pages$pages = array('index','source','directory','about','development','authors','logo','siteindex');// the first element in the $page array$tpage = in_array($page[0], $pages) ? $page[0] : null;// writes color to session if issetif(isset($_GET['c'])) $_SESSION['c'] = $_GET['c'];// calls the head function with specified color, and default if not setif(isset($_SESSION['c'])) head($_SESSION['c'], $loc, $tpage);else head(fc0, $loc, $tpage);// index if the page is nullif($tpage == null) index(); else{    // if called page is in array, then show that page.. else show index    if(in_array($page[0], $pages)) $page[0]();    else index();}foot('true');// flushes out buffer to browserob_end_flush;// functions//structure: page function then supporting functions.function index(){    top(index, 'mmddyy');    echo '<title>lucmedia - index</title>Welcome to the personal development site of Lucas Brown.<br>Please feel free to use any of the sites features and view anything as the site is being developed. <br><a href="http://getfirefox.com"><img src="http://piercedotzler.com/asa/protection.jpg" width="200"></a><a href="http://getfirefox.com">';    }function source(){    top(source, 'mmddyy');    echo '<title>lucmedia - source</title>    <div style="background-color:#CCC;">';    $self = substr($_SERVER['SCRIPT_NAME'], 1);    $expr = '/function db_connect\(\) \{[^}]+/is';    $repl = "-private db_connect() {\r\n";    highlight_string(preg_replace($expr, $repl, file_get_contents($self)));    echo "</div>";}function directory(){    top(directory, 'mmddyy');    echo '<title>lucmedia - directory</title>sites by lucas<br><a href="http://brccmen.net/" target="_blank">brccmen.net</a><br><a href="http://bassassist.com/" target="_blank">bassassist.com [old]</a><br><a href="http://omfgaturtle.net/" target="_blank">omfgaturte.net</a><br><a href="http://lucmedia.org/" target="_blank">lucmedia.org</a>';}function logo(){    top(logo, 'mmddyy');    echo '<title>lucmedia - logo</title>this is the lucmedia logo for now --- <br><img src="styles/logo.gif"><br>pesky edging...';}function siteindex(){    top(site index, 'mmddyy');    echo '<title>lucmedia - site index</title>';<?php include 'http://lucmedia.org/index_view.php'; ?>';}function about(){    top(about, 'mmddyy');    echo '<title>lucmedia - about</title>    LucMedia is a small personal development site founded by Lucas Brown.';    }function authors(){    top(authors, 'mmddyy');    echo '<title>lucmedia - authors</title><a href="http://kryptn.com/" target="_blank">kryptn </a>:: original php and design<br><a href="http://lucmedia.org/?index">lucas </a>:: content and modification<br><a href="http://nintendo8.com/" target="_blank"> nintendo8</a> :: Game Player';    }function development(){    top(development, 'mmddyy');    echo '<title>lucmedia - development</title>under construction';    }function microtime_float(){   list($usec, $sec) = explode(" ", microtime());   return ((float)$usec + (float)$sec);}function top($title, $time, $auth = 'lucmedia'){    global $page;    echo '<h1>'.$title.'</h1><div class="htimeauth">'.$time.' |';    //echo ' <a href="'.$loc.'?about='.$auth.'">'.$auth.'</a></div>'."\n";    echo ' '.$auth.'</div>'."\n";    //echo '<pre>';    //print_r($page);    //echo '</pre>';}function head($color, $location, $sub = 'index'){?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head><meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /><meta name="description" content="" /><meta name="keywords" content="" /><link rel="icon" href="styles/favicon.ico" type="image/x-icon" /><style type="text/css"><?php include 'http://lucmedia.org/styles/style.php'; ?></style></head><body>    <div id="outer">        <div class="orange"></div>        <div id="location">/lucmedia/site/<?= $sub ?>/</div>        <?php include 'http://lucmedia.org/styles/nav.php'; ?>        <div id="right"><?php}function foot($color = null){global $time_start, $page, $pages;if(in_array($page[0], $pages))    $link = '?'.$page[0].'&c=';else    $link = '?c=';$time_end = microtime_float();$time = $time_end - $time_start;?>        </div> <!-- right -->            </div> <!-- outer -->    <div id="footer">        <div class="orange"></div>        <p>        <?php if($color == true){ ?>::         <?php } ?>source rendered in (<?php echo $time; ?>) seconds        | displays best in <a href="http://tinyurl.com/zo4qr" target="_blank">firefox</a>        ::        </p>    </div>    </body></html><?php}