Hi all! Can you see the error, i've spent so many hours searching for it... 😕 i've tried everytrick in the book except for bringing it here. So here's code: (Link: http://lectrixmedia.wghq.net/ to view error) dbClass.php is attached
header.php:
<?php
/*
**
* Coding By Jon M.
* Copy Right 2005 Lectrix Media
* All Images/Themes/Etc... Made by Steve.
* Filename: _required.php
* Description: Just set up some key variables,
* and include some important files!
*/
/*
**
* Below is to stop hackers...
*/
if( !defined( "IN_SITE" ) ) {
die();
}
/*
**
* Determine Template...
*/
if( isset( $_SESSION['template'] ) ) {
$template_folder = "./templates/" . $_SESSION['template'] . "/";
} elseif( isset( $_COOKIE['template'] ) ) {
$template_folder = "./templates/" . $_COOKIE['template'] . "/";
} else {
$template_folder = "./templates/default/";
}
/*
**
* Very important variables first
*/
$__reqIncludeFolder = "/includes/"; //Site Includes Folder
$__reqModules = "/modules/"; //Modules
$__reqAdminFolder = "/admin_inc/"; //Site admin folder
$__reqSiteEmail = "jon.php@gmail.com"; //Site Email, seperate with commas
$__reqSiteCurrency = "USD"; //Currency
$__reqSiteMoneyPre = "\$"; //Money pre, for pounds etc.
$__reqSiteURL = "http://lectrix.wghq.net/"; //URL to index
$_template_folder = "/templates/"; //Templates Folder
$__reqDB = "lectrixm_main"; //Datbase
$__reqDBUser = "lectrixm_site"; //Database User
$__reqDBPass = "********"; //Database Pass
$__reqDBHost = "localhost"; //Database Host
$__reqDBpre = "lectrixm_"; //Table Pre
$__reqDBforum = "lectrixm_forum"; //Your forum databse...
$links = "/modules/";
/*
**
* Very important includes now
*/
require( "." . $__reqIncludeFolder . "_dbClass.php" );
/*
**
* Now for some site variables from the DB
*/
$DB = new DB( $__reqHost, $__reqDBUser, $__reqDBPass, $__reqDB );
$select = $DB->Select( );
$_config = $DB->Fetch( "SELECT * FROM " . $__reqDBpre . "config LIMIT 1" );
$__siteTitle = $_config['title'];
$__siteCopyright = $_config['copyright'];
$__siteMessage = $_config['message'];
$__siteHits = $_config['hits'];
$__siteUnique = $_config['unique'];
$__siteIP = $_SERVER['REMOTE_ADDR'];
require( "functions.php" );
require( "." . $__reqIncludeFolder . "_templateClass.php");
?>
functions.php
<?php
/*
**
* Coding By Jon M.
* Copy Right 2005 Lectrix Media
* All Images/Themes/Etc... Made by Steve.
* Filename: _templateClass.php
* Description: Simply create a list of
* functions to run at any given time... duh ;)
*/
/*
**
* Below is to stop hackers...
*/
if( !defined( "IN_SITE" ) ) {
die();
}
/*
**
* Function OpenTable:
* Opens up or starts a table from the designers template
*/
function OpenTable( $template_folder ) {
$open_table = include_once( $template_folder . "opentable.php" );
echo $open_table;
}
/*
**
* Function CloseTable:
* Quickly closes a table...
*/
function CloseTable( ) {
echo'</td></tr></table>';
}
/*
**
* Function openerrortable:
* Opens and sets the error...
*/
function openerrortable( $error ) {
switch( $error ) {
case "1":
$error = "Illegal File, please choose another file, thank you!";
break;
case "2":
$error = "File does not exist, please choose another file, thank you!";
break;
case "3":
$error = "You were banned from this site, please <a href=\"mailto: [email]jon.php@gmail.com[/email]\">E-Mail us if you feel this is a mistake</a>";
break;
case "4":
$error = "The site is currently closed for matinence, we apologize for any inconvienence. Please check back soon!";
break;
case "5":
$error = "Hacking attempt!";
break;
}
OpenTable( $template_folder );
echo( $error );
CloseTable( );
$insert_error = $DB->Query( "INSERT INTO " . $__reqDBpre . "errors('error_id','real_time','problem','ip') VALUES('NULL',NOW(),$error,$__siteIP) " );
}
?>
Template Class:
<?php
/*
**
* Coding By Jon M.
* Copy Right 2005 Lectrix Media
* All Images/Themes/Etc... Made by Steve.
* Filename: _templateClass.php
* Description: Just make a simple template system,
* to save time for our designers and coders ;).
*/
/*
**
* Below is to stop hackers...
*/
if( !defined( "IN_SITE" ) ) {
die();
}
/*
**
* Here is the Template class
* function Template: Get's the theme...
* function SetParameters: Set's the {Blah} {Blah}
* function Links: Get's links from the db.
* function Content: Get's pages detereming $do
* function CreatePage: Does all work, replaces {Blah} with $Blah;
*/
class Template {
var $template;
var $html;
var $parameters = array( );
var $content;
/*
**
* Template function, define variables...
*/
function Template( $template ) {
$this->template = $template;
$this->html = implode( "", ( file( $this->template ) ) );
}
/*
**
* SetParameters function, define array.
*/
function SetParameter( $variable, $vaule ) {
$this->parameters[$variable] = $value;
}
/*
**
* Links function, get links
*/
function Links( $linksfolder ) {
$open = opendir( "./modules/" );
while( $file = readdir($open ) ) {
if( ( is_dir( $file ) ) and (substr( $file, 0, 1 ) != "." ) ) {
$name = str_replace( "_", " ", $file );
$nav_links .= "<a href=\"index.php?do=$file/\">$name</a><br /> \n";
}
}
closedir( $open );
return $nav_links;
}
/*
**
* Content function...
*/
function Content( $do ) {
if( !isset( $do ) || $do == "" ) {
$do = "./modules/home/";
$this->content = include( $do );
return$this->content;
} elseif ( !eregi("^[-?_?a-z0-9]+$",$area) && $area != "") { //Only allow a-z, 0-9, -, _ :)
//Let's stop them
$error = openerrortable( "1" );
return $error;
//Close if( !eregi("") ...
}
elseif ( file_exists("./modules/" . $do . "/") ) {
//Check if the file exists
$this->content = include("./modules/" . $do . "/");
return $this->content;
//Close elseif( file_ex ...
} else {
$error = openerrortable( "2" );
return $error;
}
}
/*
**
* CreatePage function, create the page...
*/
function CreatePage( ) {
foreach( $this->parameters as $key => $value ) {
$template_name = '{' . $key . '}';
$this->html = str_replace( $template_name, $value, $this->html );
}
echo $this->html;
}
/*
**
* Done with class Template
*/
}
?>
default.php:
<?php
/*
**
* Coding By Jon M.
* Copy Right 2005 Lectrix Media
* All Images/Themes/Etc... Made by Steve.
* Filename: _templateClass.php
* Description: Just make a simple template system,
* to save time for our designers and coders ;).
// */
/*
**
* Below is to stop hackers...
*/
define("IN_SITE","TRUE");
require_once("_header.php");
/*
**
* Here we go, let's just do the template system and blow this place... :)
*/
require("_header.php");
/*
**
* Set the template, and we're done
*/
$do = $_GET['do'];
$page = new Template( $template_folder );
$page->SetParameter( "SITE_TITLE",$__siteTitle );
$page->SetParameter( "SITE_COPYRIGHT",$__siteCopyright );
$page->SetParameter( "SITE_LINKS",$page->Links( $links ) );
$page->SetParameter( "SITE_CONTENT",$page->Content( $do ) );
$page->CreatePage( );
?>