Location: PHPKode > scripts > Free PHP Recipes Plug-n-Play Website Script > free-php-recipes-plug-n-play-website-script/index.php
<?php
/************* Recipe *****************************/
/*
Released by AwesomePHP.com, under the GPL License, a
copy of it should be attached to the zip file, or
you can view it on http://AwesomePHP.com/gpl.txt
*/
/************* Recipe *****************************/

// Start Session
session_start();

// Get Extension Files
require_once('includes/database.php');
require_once('includes/configs.php');

// List of all pages on the site
$SITE_PAGES = array('main','r','v','s','privacy');

/*
List of all pages on the site that 
requires database Subset of $SITE_PAGES
*/
$SITE_PAGES_DATABASE = array('main','r','v','s');

// Get paramters
$QUERY = explode('*',$_SERVER['QUERY_STRING']);
if($_GET['message'] != NULL){$message = $_GET['message'];}

// Page to show
$PAGE = strtolower($QUERY[0]);
if(!in_array($PAGE,$SITE_PAGES)){ $PAGE = 'main';}
if(in_array($PAGE,$SITE_PAGES_DATABASE)){
	$error = connect();
	if($error != NULL){
		@mail($ADMIN_EMAIL,"$SITE_NAME database is down","Database Error: $error");
		die ('Database Error, Sending Error Notice to Administrator.');
	}
	$END_FUNCTION = 'disconnect_data';
}

// Get advertisement
ob_start();
include($ADS_PAGE);
$ADVERTISEMENT = ob_get_contents();
ob_end_clean();

ob_start();
include($ADS_PAGE_XL);
$ADVERTISEMENT_XL = ob_get_contents();
ob_end_clean();

// Get actual page content
ob_start();
include($PAGE.'.php');
$MAIN_BODY = ob_get_contents();
ob_end_clean();

// Get Template
ob_start();
include('template.php');
$SHOW_BODY = ob_get_contents();
ob_end_clean();

echo $SHOW_BODY;

// Close Database?
if($END_FUNCTION != NULL){
	$END_FUNCTION();
}
?>
Return current item: Free PHP Recipes Plug-n-Play Website Script