Location: PHPKode > projects > Pratt Content-Management-System (CMS) > prattcms/variables/db_connect.var.php
<?php


/*
This file is (C) Copyright 2003 by the Pratt Museum and licensed under the GPL.
Please see the README for details.

File: $root/variables/db_connect.var.php
Description: global variables outputed by install scripts
Notes: This file is currently being used for a prototype for the calendar of events
	page to see if this project will take off.
*/
	//include the PEAR file
	require_once ('DB.php');
	
	$_SESSION['db_string'] = $database_string;
	
	//PEAR DB Connect
	$db = DB::connect($database_string);
	//some error handling here...
	if (DB::iserror($db)) {
		require_once("admin/classes/error_report.class.php");
		$error = new Error;
		$error->report($db,__LINE__,__FILE__);
	}
	
	//page id to new variable
	$global_var_id = $this->pg_id;

	//we need to check for modules. if they 
	//  exist the id needs to be overriden
	//  but ONLY if we're not in the admin
	if (!$_SESSION['logged_in'] && !$_POST['step']){
		$mod_check = "SELECT * FROM modules WHERE id=" . $this->pg_id;
		//run the query
		$mod_query = $db->getRow($mod_check);
		//error checking
		if (DB::iserror($mod_query)) {
			require_once("admin/classes/error_report.class.php");
			$error = new Error;
			$error->report($mod_query,__LINE__,__FILE__);
		}
		if ($mod_query) {
			require (getcwd() . "/modules/" . $mod_query[5]);
			exit;
		}
	}
	
?>
Return current item: Pratt Content-Management-System (CMS)