Location: PHPKode > projects > CMSmelborp > CMSmelborp/includes/user_standard.php
<?php
/*******************************************************************************
License:
	Copyright 2005 Ryan Morehart
	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at
	
	http://www.apache.org/licenses/LICENSE-2.0
	
	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
	
Filename: /includes/user_standard.php

Purpose: Does things almost everything in CMSmelborp uses, such as connect to the database
	and save beginning times. In addition, it includes the most common things.

Processed parameters: (TYPE - NAME - DESCRIPTION - DEFAULT)
	None
*******************************************************************************/

// Save beginning of script execution time
$beginTime = microtime();

// Figure out where the script which is including this is relative to this one so we can
// include more stuff. Try to find showpage.php
$possible_depths = array('.', '../..');
foreach($possible_depths as $current)
{
	if(file_exists($current . '/showpage.php'))
	{
		$relative_root = $current;
		break;
	}
}

// Include common things
require_once "$relative_root/includes/settings.php";
require_once "$relative_root/includes/pages.php";
require_once "$relative_root/includes/loops.php";
require_once "$relative_root/includes/templates.php";
require_once "$relative_root/includes/images.php";
require_once "$relative_root/includes/external_files.php";

// Page expires in the number of minutes set in settings.php
$currentTime = time();
$expirationTime = $currentTime + 60 * $page_expiration_time;
header('Expires: ' . date('M d Y H:i:s EST', $expirationTime));

// Connect to database
$connection = @mysql_connect($db_host, $db_user, $db_pass);
if($connection === false)
{
	die("Failed to connect to database.");
}
if(mysql_query("USE $db_data;") === false)
{
	die("Database does not exist.");
}
?>
Return current item: CMSmelborp