//Start Session if (isset($_GET['PHPSESSID']) == true) { session_id($_GET['PHPSESSID']); } session_start(); //Load regularly Used Classes require 'clslogin.php'; require 'clsphpmethods.php'; require 'clstables.php'; //Load Constants require 'constants.php'; //Create Tables require 'createproducttable.php'; require 'createordertable.php'; require 'createcustomertable.php'; require 'createdeletetable.php'; //Load Objects Required For Every Page $counter = 1; do { if (file_exists('htmlfiles/everypage/everypagecodebefore' . $counter . '.php') == true) { require 'htmlfiles/everypage/everypagecodebefore' . $counter . '.php'; } if (file_exists('htmlfiles/everypage/everypageheader' . $counter . '.txt') == true) { $handle = fopen('htmlfiles/everypage/everypageheader' . $counter . '.txt', 'r'); $HEADER = $HEADER . fread($handle, filesize('htmlfiles/everypage/everypageheader' . $counter . '.txt')); fclose($handle); } if (file_exists('htmlfiles/everypage/everypagecodeinstead' . $counter . '.php') == true) { require 'htmlfiles/everypage/everypagecodeinstead' . $counter . '.php'; } else { $handle = fopen('htmlfiles/everypage/everypagebody' . $counter . '.txt', 'r'); $BODY = $BODY . fread($handle, filesize('htmlfiles/everypage/everypagebody' . $counter . '.txt')); fclose($handle); } if (file_exists('htmlfiles/everypage/everypagecodeafter' . $counter . '.php') == true) { require 'htmlfiles/everypage/everypagecodeafter' . $counter . '.php'; } $counter = $counter + 1; } while(file_exists('htmlfiles/everypage/everypagebody' . $counter . '.txt') == true); //Obtain the path of the file to run before other page objects are loaded $beforeload_path = ''; if (isset($_GET['page']) == true) { $beforeload_path = 'htmlfiles/' . $_GET['page'] . '/' . $_GET['page'] . 'codebeforeload.php'; } else { $beforeload_path = 'htmlfiles/home/homecodebeforeload.php'; } if (file_exists($beforeload_path) == true) { require $beforeload_path; } //Obtain Path of Other Files $counter = 1; $body_path = ''; $header_path = ''; $codebefore_path = ''; $codeafter_path = ''; $codeinstead_path = ''; if (isset($_GET['page']) == true) { $body_path = 'htmlfiles/' . $_GET['page'] . '/' . $_GET['page'] . 'body' . $counter . '.txt'; $header_path = 'htmlfiles/' . $_GET['page'] . '/' . $_GET['page'] . 'header' . $counter . '.txt'; $codebefore_path = 'htmlfiles/' . $_GET['page'] . '/' . $_GET['page'] . 'codebefore' . $counter . '.php'; $codeafter_path = 'htmlfiles/' . $_GET['page'] . '/' . $_GET['page'] . 'codeafter' . $counter . '.php'; $codeinstead_path = 'htmlfiles/' . $_GET['page'] . '/' . $_GET['page'] . 'codeinstead' . $counter . '.php'; } else { $body_path = 'htmlfiles/home/homebody' . $counter . '.txt'; $header_path = 'htmlfiles/home/homeheader' . $counter . '.txt'; $codebefore_path = 'htmlfiles/home/homecodebefore' . $counter . '.php'; $codeafter_path = 'htmlfiles/home/homecodeafter' . $counter . '.php'; $codeinstead_path = 'htmlfiles/home/homecodeinstead' . $counter . '.php'; } $processed = false; $bottomtop = 1124; //Get individual objects from File do { $processed = false; if (file_exists($codebefore_path) == true) { require $codebefore_path; $processed = true; } if (file_exists($header_path) == true) { $handle = fopen($header_path, 'r'); $HEADER = $HEADER . fread($handle, filesize($header_path)); fclose($handle); $processed = true; } if (file_exists($codeinstead_path) == true) { require $codeinstead_path; $processed = true; } else { if (file_exists($body_path) == true) { $handle = fopen($body_path, 'r'); $BODY = $BODY . fread($handle, filesize($body_path)); fclose($handle); $processed = true; } } if (file_exists($codeafter_path) == true) { require $codeafter_path; $processed = true; } $counter = $counter + 1; //Obtain paths of next object if (isset($_GET['page']) == true) { $body_path = 'htmlfiles/' . $_GET['page'] . '/' . $_GET['page'] . 'body' . $counter . '.txt'; $header_path = 'htmlfiles/' . $_GET['page'] . '/' . $_GET['page'] . 'header' . $counter . '.txt'; $codebefore_path = 'htmlfiles/' . $_GET['page'] . '/' . $_GET['page'] . 'codebefore' . $counter . '.php'; $codeafter_path = 'htmlfiles/' . $_GET['page'] . '/' . $_GET['page'] . 'codeafter' . $counter . '.php'; $codeinstead_path = 'htmlfiles/' . $_GET['page'] . '/' . $_GET['page'] . 'codeinstead' . $counter . '.php'; } else { $body_path = 'htmlfiles/home/homebody' . $counter . '.txt'; $header_path = 'htmlfiles/home/homeheader' . $counter . '.txt'; $codebefore_path = 'htmlfiles/home/homecodebefore' . $counter . '.php'; $codeafter_path = 'htmlfiles/home/homecodeafter' . $counter . '.php'; $codeinstead_path = 'htmlfiles/home/homecodeinstead' . $counter . '.php'; } } while($processed == true); //Replace Position Tags $BODY = str_replace('!!!every_page_replace_1!!!', $bottomtop, $BODY); $bottomtop = $bottomtop + 33; $BODY = str_replace('!!!every_page_replace_2!!!', $bottomtop, $BODY); $bottomtop = $bottomtop + 145; $BODY = str_replace('!!!every_page_replace_3!!!', $bottomtop, $BODY); if (isset($_GET['PHPSESSID']) == true && SID == '') { $BODY = str_replace('index.php?', 'index.php?PHPSESSID=' . $_GET['PHPSESSID'] . '&', $BODY); } else { $BODY = str_replace('action="index.php?', 'action="index.php?'. SID . '&', $BODY); } $HEADER = str_replace('[title]', $maintitle, $HEADER); //Write HTML Data to Browser. $DATA = '
' . $HEADER . '