Location: PHPKode > projects > ProPHP > ProPHP/index.php
<?php
	/*****************************************************************
	************* BKWORKS PRO PHP V 0.5 BETA 1 ***********************
	******************** BRYAN KOOIENGA ******************************
	****************** DECEMBER 20, 2007 *****************************
	*****************************************************************/
	define("INDEX","true"); # Every page in this piece of software looks for this as true. It tells them that it is the index calling them, not somebody snooping around.
	include("include/db_info.php"); # This is our database file.
	if($error != "") {
		$view = "dberror"; # If the db_info.php file threw an error, then this detects it for us and tells us to inform the user.
	}
	session_start(); # Creates the session that we use to keep track of the logged in user.
	/*session_register("user","error_text"); */ # This line is only valid for PHP 4 or earlier. Uncomment if you are not using PHP 5 or later.

	# Here we check if the user is logged in.
	/* Disabled for PHP 5 Functionability. Enable only if using PHP 4 or lower.
	session_register('user'); */
	if(!empty($_SESSION['user'])) {
		$username = $_SESSION['user']; # If the session variable is set, then we set our local working variable to the value.
	} else {
		$username = ""; # If not, then we blank the username. Useful for those setups with REGISTER_GLOBAL_VARS turned on.
	}
	
	//This here is code that isn't finished as of Beta 1. Expect it by Beta 2
	$error_code = $_GET['error_code'];
	$form = $_GET['form'];
	if($error_code && $form) {
		$code[1] = "Your account is suspended or not yet activated.";
		$code[2] = "Invalid Username / Password";
		$error = $code[$error_code];
	}
	
	
	if($view != "dberror") { # If there's no database connection error, then...
		$view = $_GET['view']; # The view is set to what is sent by the browser.
		$view = strtolower($view); # And then we make it lowercase.
	}
	if($view != "register" && $view != "process_register" && $view != "dberror" && $username == "") {
	#long story short. If the view is not register, process register, or dberror, and the username is equal to nothing, then we're showing the logon page.
		$view = "home";
	}
	switch($view) { # We're telling the template which page to load.
	
		case "dberror":
			$page = "install/db_error.php";
			$title = "Error!";
		break;
		
		case "":
		case "home":
			if($_SESSION['user'] == "") {
				$page = "homepage/index.php";
				$title = "Homepage";
			} else {
				$page = "ads_home/index.php";
				$title = "Welcome";
			}
		break;
		
		case "adshome":
			$page = "ads_home/index.php";
			$title = "Welcome";
		break;
		
		case "adoptions":
			$page = "ad_options/index.php";
			$title = "Ad Options";
		break;
		
		case "viewads":
			$page = "ad_options/view.php";
			$title = "View Ads";
		break;
		
		case "add_ad":
			$page = "ad_options/add.php";
			$title = "Add an Ad";
		break;
		
		case "delete":
			$page = "ad_options/delete.php";
			$title = "Delete an Ad";
		break;
		
		case "logoff":
			header("location: content/homepage/logoff.php"); # Send the browser to the logoff page.
		break;
		
		case "adscripts":
			$page = "public/scripts.php";
			$title = "Get Ad Scripts";
		break;
		
		case "profile":
			$page = "public/profile.php";
			$title = "Profile";
		break;
		
		case "admin":
			$page = "admin/admin.php";
			$title = "Admin Panel";
		break;
		
		case "admin_suspend":
			$page = "admin/suspend.php";
			$title = "Suspend a User";
		break;
		
		case "admin_delete":
			$page = "admin/delete.php";
			$title = "Delete a User";
		break;
		
		case "admin_settings":
			$page = "admin/save_settings.php";
			$title = "Update Settings";
		break;
		
		case "register":
			$page = "register/index.php";
			$title = "Registration";
		break;
		
		case "process_register":
			$page = "register/process_register.php";
			$title = "Processing Registration...";
		break;
	}
	include('include/version.php');	
?>
<!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>
<title>BKWorks ProPHP - <?php echo $title; ?></title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="style.css" type="text/css" media="screen" /></head>

<body>
<div id="container">

<div id="sitename">
<h1>BKWorks ProPHP Ad Swap Network </h1>
<h2>The best <em>free, open source</em> ad-swap network! </h2>
</div>

<div id="mainmenu" align="center">
<?php include("include/main_toolbar.php"); ?>
</div>
 
<div id="wrap">
<div id="rightside">
<?php include_once("include/toolbar.php"); ?>
</div>
<div id="contentalt" >
<?php
/************************************
Removed on 02-07-07. It was used for debugging purposes.
You can uncomment it if you want to know where each "view" is heading.
echo "<b>PAGE: $page</b><br>";
***********************************/
if(file_exists("content/$page")) { # If the file we want is actually on the server then...
	include_once("content/$page"); # Show it!
} else { # If not...
	if(file_exists("content/$view")) { # Let's check for the view itself. Maybe it's there. If so,
		include_once("content/$view"); # Let's show it!
	} else { # Neither exist. Write the error message.
		echo "<h3>File Doesn't Exist!</h3>
		We're sorry, but we can't find the file you requested!";
	}
}
?>
</div>

<div class="clearingdiv">&nbsp;</div>
</div>
</div>
<div id="footer">
Powered by BKWorks ProPHP Version <?=$version; ?><br />
Copyright 2007 BKWorks Products.<br />
All Rights Reserved.</div>
</body>
</html>
<?php if($db) mysql_close($db); # Checks to make sure that the pages that need the database have closed their connections. If not, then close it here ?>
Return current item: ProPHP