So, since I asked a stupid question, I figured I ought to make a contribution.
I've currently stripped out the beginning and end of page stuff into an includable header and footer, so when you go to add it all to another page, it's just a pair of include statements, instead of a giant pile of code. Put these files in the include directory. I'm including the css file we use, because it pretties things up. Feel free to substitute your own.
header.php:
footer.php
beta.css
To include the header and footer in a new page, add the following lines:
At the top:
I've currently stripped out the beginning and end of page stuff into an includable header and footer, so when you go to add it all to another page, it's just a pair of include statements, instead of a giant pile of code. Put these files in the include directory. I'm including the css file we use, because it pretties things up. Feel free to substitute your own.
header.php:
- Code:
<?
/**
* Header.php
*
* This is the header of all the WF BRD pages. The sidebar
* contains the login form and the user menu. See footer.php
* for the bottom of the page
*
* Based on work by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC)
* Modded for WF BRD by Ywain (the Bastard) Penbrydd & Thoth II
* May 22, 2010
*/
require("include/session.php");
?>
<html>
<head>
<title><?php echo $GLOBALS['local_title'] . " - INSERT YOUR SITE NAME HERE"; ?></title>
<meta name="description" content="DESCRIBE YOUR SITE HERE" />
<meta name="keywords" content="SITE KEYWORDS HERE" />
<meta name="author" content="YOUR NAME HERE" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="include/beta.css" rel="stylesheet" type="text/css">
</head>
<body>
<table>
<tr><td valign="top" width="200px">
<div class="set">All Users</div>
[<a href="index.php">Home</a>] <br />
[<a href="search.php">Search</a>] <br />
[<a href="browse.php">Browse</a>] <br />
<? if(!$session->logged_in){
echo "[<a href=\"register.php\">List yourself</a>] <br />";
} ?>
<div class="set">Members</div>
<?
/**
* User has already logged in, so display relavent links, including
* a link to the admin center if the user is an administrator.
*/
if($session->logged_in){
echo "Welcome back, <b>$session->username</b>. <br><br>"
."[<a href=\"userinfo.php?user=$session->username\">View Profile</a>] <br />"
."[<a href=\"useredit.php\">Edit Account</a>] <br />";
if($session->isAdmin()){
echo "[<a href=\"admin/admin.php\">Admin Center</a>] <br />";
}
echo "[<a href=\"process.php\">Logout</a>]";
}
else{
/**
* User not logged in, display the login form.
* If user has already tried to login, but errors were
* found, display the total number of errors.
* If errors occurred, they will be displayed.
*/
if($form->num_errors > 0){
echo "<font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font>";
}
?>
<form action="process.php" method="POST">
<table border="0" cellspacing="0" cellpadding="3">
<tr><td>Username:</td><td><input type="text" name="user" maxlength="20" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr>
<tr><td>Password:</td><td><input type="password" name="pass" maxlength="20" value="<? echo $form->value("pass"); ?>"></td><td><? echo $form->error("pass"); ?></td></tr>
<tr><td colspan="2"><div class="small"><input type="checkbox" name="remember" <? if($form->value("remember") != ""){ echo "checked"; } ?>>Remember me next time</div>
<input type="hidden" name="sublogin" value="1"><input type="submit" value="Login"></td></tr>
<tr><td colspan="2"><span class="small">[<a href="forgotpass.php">Forgot Password?</a>]</span></td></tr>
</table>
</form>
<?
}
?>
</td>
<td>
footer.php
- Code:
</td></tr>
<tr><td colspan="2" style="text-align:center;"><br><br>
<?
/**
* Just a little page footer, tells how many registered members
* there are, how many users currently logged in and viewing site,
* and how many guests viewing site. Active users are displayed,
* with link to their user information.
*/
echo "<div class=\"small\"><b>Member Total:</b> ".$database->getNumMembers()."<br>";
echo "There are $database->num_active_users registered members and ";
echo "$database->num_active_guests guests viewing the site.</div>";
include("include/view_active.php");
?>
<div class="tiny">Login and session-handling based on Jpmaster77's <a href="http://evolt.org/PHP-Login-System-with-Admin-Features">PHP Login System with Admin Features</a>. INCLUDE YOUR SITE DISCLAIMERS HERE</div>
</td></tr>
</table>
</body>
</html>
beta.css
- Code:
/*
* WF Beta Directory CSS
* 2010.05.24 by Ywain Penbrydd & Thoth II
*/
body {
background-color: #FFFFFF;
font: Verdana, Arial, sans-serif;
color: #000000;
text-align: justify;
vertical-align: top;
}
h1 {
font-size: 1.75em;
}
td {
text-align:justify;
vertical-align:top;
}
.huge {
font-size: 1.75em;
}
.big {
font-size: 1.25em;
}
.normal {
font-size: 1em;
}
.small {
font-size: .8em;
}
.tiny {
font-size: .6em;
}
.set {
font-size: 1.25em;
background-color: #CCCCCC;
}
To include the header and footer in a new page, add the following lines:
At the top:
- Code:
<? $GLOBALS['local_title'] = "TITLE OF THIS PAGE";
include("include/header.php"); ?>
- Code:
<? include("include/footer.php"); ?>