Location: PHPKode > projects > ClassSimple > page.header.php
include_once ("../../functions.php");

if ($_GET['mode'] == "verify_login"){
	//Login user
	$db['roster'] = open_db(__FILE__, __LINE__, "../../db/roster.db");
	$student = fetch(query(__FILE__, __LINE__, $db['roster'], "SELECT * FROM students WHERE first_name='" . 
	  $_POST['fname'] . "' AND last_name='" . $_POST['lname'] . "' LIMIT 1"));
	if ($student['password'] == sha1($_POST['password'])){
		$_SESSION['sid'] = $student['id'];
		$_SESSION['msg']['type'] = "good";
		$_SESSION['msg']['text'] = "Login Successful!";
		$_SESSION['msg']['type'] = "bad";
		$_SESSION['msg']['text'] = "Login Failed.  Please verify username and password and try again.";

if ($_GET['mode'] == "log_out"){
	$_SESSION['msg']['type'] = "good";
	$_SESSION['msg']['text'] = "Log out Successful!";

$db['pages'] = open_db(__FILE__, __LINE__, "../../db/pages.db");
$db['core'] = open_db(__FILE__, __LINE__, "../../db/core.db");

if (isset($_GET['p'])){
	$page = fetch(query(__FILE__, __LINE__, $db['pages'], "SELECT * FROM pages WHERE id='" . $_GET['p'] . "'"));
	$page['id'] = $_GET['p'];	//Needed for non-exsistant pages to error out
	//Being called from outside of pages/view.php, and assume pub is avaliable
	$page['pub'] = "available";
	//Some pages set a $TITLE varable
	$page['title'] = $TITLE;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<link rel="stylesheet" type="text/css" href="../../main.css"></head>

<!--Body Table-->
<table cellpadding="0" cellspacing="0" border="0" align="center" width="95%" class="body-table">
	<tr><td colspan="2" class="header-title">
	$result = fetch(query(__FILE__, __LINE__, $db['core'], "SELECT * FROM settings WHERE key='class'"));
	echo $result['value'];
	$WEBSITE['class'] = $result['value'];
	$result = fetch(query(__FILE__, __LINE__, $db['core'], "SELECT * FROM settings WHERE key='prof'"));
	$WEBSITE['prof'] = $result['value'];
	$result = fetch(query(__FILE__, __LINE__, $db['core'], "SELECT * FROM settings WHERE key='prof_email'"));
	$WEBSITE['prof_email'] = $result['value'];
	<tr><td width="200" valign="top">
	<!--Menu of all the modules -->
	<div class="menu">
	$db['menu'] = open_db(__FILE__, __LINE__, "../../db/menu.db");
	$result = query(__FILE__, __LINE__, $db['menu'], "SELECT * FROM menu ORDER BY placement ASC");
	while ($row = fetch($result)){
		echo "<li><a href=\"" . $row['link'] . "\">" . $row['title'] . "</a></li>";
	if (isset($_SESSION['sid'])){
		//If logged in, show log off
		echo "<li><a href=\"../roster/register.php?mode=log_out\">Log Out</a></li>";
	</td><td valign="top">
if (isset($_SESSION['msg'])){
	if ($_SESSION['msg']['type'] == "good"){
		$img = "../../good.gif";
	}elseif ($_SESSION['msg']['type'] == "bad"){
		$img = "../../bad.gif";
<table width="100%" border="0" class="msg">
<tr><td width="75"><img src="<?=$img?>" height="50" width="50" style="margin: 7px;"></td>

//If restricted, demand login
if ($RESTRICTED && !isset($_SESSION['sid'])){
<h1>Login Required</h1>
<p>This page contains sensitive data that require the authentication of your identity.  Please fill
out the form below:</p>

<form action="?mode=verify_login" method="post">
<table width="100%" border="0">
<tr><td class="form-label">First Name:</td><td><input type="text" name="fname"></td></tr>
<tr><td class="form-label">Last Name:</td><td><input type="text" name="lname"></td></tr>
<tr><td class="form-label">Passowrd:</td><td><input type="password" name="password"></td></tr>
	<input type="submit" value="Login">

include ("../../admin.footer.php");

Return current item: ClassSimple