Files
jameswitzeman.net/php/header.php
T
2026-05-29 11:30:10 -07:00

63 lines
1.7 KiB
PHP

<?php
require_once "functions.php";
// Header file for drawing common headers
// Initialized Variables
$path = "/"; // Path of the current content file
$headhtml = ""; // Header HTML to display
$strindex = 0; // Int for indexing strings
$findstr = ""; // String for searching
$motd = ""; // Message of the Day for header
// Defined Variables
$datea = getdate();
$datestr = $datea["month"] . " " . $datea["mday"] . ", " . $datea["year"];
// Build the <head> element.
build_head();
// Here, get the path of the HTML to display in the body, and save it
// in a string.
if (sizeof($_GET) == 0) {
$path = "content/home.html";
}
else {
$path = "content/" . $_GET['q'];
}
// Build title and top bar.
$headhtml = <<<EOF
<div id='head'>
<div id='titlebar'>
<div class='item1'><h1>world-wide-witzeman</h1></div>
<div class='item2'></div>
</div>
<div id='subhead'>
<div id='motd'></div>
<ul>
<li><a href='?'>home</a></li>
<li><a href='?q=services.html'>services</a></li>
<li><a href='?q=contact.html'>contact</a></li>
<li><a href='?q=about.html'>about</a></li>
</ul>
</div>
</div>
EOF;
// Build MOTD (Message of the Day.)
$motd = build_motd(array(
// $_SERVER['HTTP_X_FORWARDED_FOR'],
// $datestr,
clean_fn($path),
));
//$motd = $_SERVER['REMOTE_ADDR'] . "\t" . $datestr . "\t" . clean_fn($path);
// We want the 'data' div to contain our message of the day
// we're displaying. So, we insert that in the proper place.
$findstr = "motd";
$strindex = strpos($headhtml, $findstr) + 6;
$headhtml = substr_replace($headhtml, $motd, $strindex, 0);
echo $headhtml;
?>