rendered paste body<?phptry{/* File Permissions--------------------------------------------------------------------------------------------------------------*/ //attention!/* .htaccess .htpasswd--------------------------------------------------------------------------------------------------------------*/ //attention!/* PDO--------------------------------------------------------------------------------------------------------------*/if( !extension_loaded( "pdo" ) ){ throw new Exception( "", "1001" ); }//checking pdo driver$pdo_drivers = pdo_drivers();if( !in_array( $cfg['db_type'], $pdo_drivers ) ){ throw new Exception( "", 1002 );}//checking database connection$pdo = new PDO( $cfg['pdo'], $cfg['db_user'], $cfg['db_pass'], array( PDO::ATTR_PERSISTENT => false ) );$conn = NULL;}catch( PDOException $pdoe ){ die( "Exception: " . $pdoe -> getCode() . "\n" ); }catch( Exception $e ){ die( "Exception: " . $e -> getCode() . "\n" );}?><?php/* Flush Output Buffer--------------------------------------------------------------------------------------------------------------*/ob_flush();?><?php$cfg = array();/* Database--------------------------------------------------------------------------------------------------------------*/$cfg['db_type'] = "mysql";$cfg['db_host'] = "localhost";$cfg['db_user'] = "root";$cfg['db_pass'] = "uhhh die laat ik weg";$cfg['db_name'] = "awaroxweb";/* AutoConfig Database--------------------------------------------------------------------------------------------------------------*///connection string$cfg['pdo'] = $cfg['db_type'] . ":host=" . $cfg['db_host'] . ";dbname=" . $cfg['db_name'];//attributes$cfg['pdo_attributes'] = array( PDO::ATTR_PERSISTENT => true //persistent connection );//tablenames$cfg['db_tables'] = array();$cfg['db_tables']['configuration'] = "configuration";$cfg['db_tables']['exception'] = "exception";$cfg['db_tables']['images'] = "images";$cfg['db_tables']['css'] = "css";$cfg['db_tables']['text'] = "text";/* Paths [end dir with a forward slash!]--------------------------------------------------------------------------------------------------------------*/$cfg['path'] = array();//base$cfg['path']['base'] = "/websites/awarox/awaroxweb/"; //attention!: requires automatic determination!//homepage$cfg['path']['homepage'] = "pages/home/";//dirs$cfg['path']['js_dir'] = "javascript/";$cfg['path']['image_dir'] = "images/";$cfg['path']['css_dir'] = "css/";$cfg['path']['module_dir'] = "modules/";/* Modules--------------------------------------------------------------------------------------------------------------*/$cfg['module']['include_file'] = "include.php";$cfg['module']['action_file'] = "action.php";$cfg['module']['install_file'] = "install.php";$cfg['module']['uninstall_file'] = "uninstall.php";$cfg['module']['check_file'] = "check.php";?><?php/* Open--------------------------------------------------------------------------------------------------------------*/require_once( 'open.inc.php' );/* Print CSS--------------------------------------------------------------------------------------------------------------*/print( $_SESSION['css'] -> output() );/* HTTP Headers--------------------------------------------------------------------------------------------------------------*/header( "Content-Type: text/css" );header( "Pragma: no-cache" );/* Close--------------------------------------------------------------------------------------------------------------*/require_once( 'close.inc.php' );?><?phprequire_once( 'open.inc.php' );//attention!: it might be a good idea to make this file object-orientedtry{ $file = $_REQUEST["file"]; $newwidth = $_REQUEST["width"]; $newheight = $_REQUEST["height"]; $file = new Input( $_REQUEST["file"] ); $file -> makePathSafe(); $file = (string) $file; //make sizes secure //attention!: requires class for secure input if( !is_numeric( $newheight ) || !is_numeric( $newwidth ) ) { throw new AwaroxException( "One of the specified REQUEST width / height is not an Integer.", 6401, $db ); } //file to path $file= $cfg['path']['image_dir'] . $file; //file exists + is image if( !file_exists( $file ) ) { throw new AwaroxException( "Requested image does not exist.", 6501, $db ); } if( !is_file( $file ) ) { throw new AwaroxException( "Image is not a regular file, though does exist.", 6502, $db ); } $size = getimagesize( $file ); if( $size === "false" ) { throw new AwaroxException( "Requested image does not seem an image.", 6503, $db ); } //image properties $oldheight = $size[1]; $oldwidth = $size[0]; $mime = $size["mime"]; //useless to increase the size by the server, we only want to decrease it if( $newheight > $oldheight || $newwidth > $oldwidth ) { header( "Location: " . $cfg['path']['base'] . $file ); } //get old image switch( $mime ) { case "image/png": $oldimg = imagecreatefrompng( $file ); break; case "image/jpeg": $oldimg = imagecreatefromjpeg( $file ); break; case "image/gif": $olding = imagecreatefromgif( $file ); break; default: header( "Location: " . $cfg['path']['base'] . $file ); die(); } //create new image $newimg = imagecreatetruecolor( $newwidth, $newheight ); //resize image imagecopyresampled( $newimg, $oldimg, 0, 0, 0, 0, $newwidth, $newheight, $oldwidth, $oldheight ) or die( "Troubles..." ); //sent header header( "Content-Type: " . $mime ); //sent image switch( $mime ) { case "image/png": imagepng( $newimg ); break; case "image/jpeg": imagejpeg( $newimg ); break; case "image/gif": imagegif( $newimg ); break; default: }}catch( AwaroxException $awe ){ echo $awe;}require_once( 'close.inc.php' );?><?php/* Open--------------------------------------------------------------------------------------------------------------*/require_once( 'open.inc.php' );/* Banlist--------------------------------------------------------------------------------------------------------------*/$ban = new mod_ban( "systemBan", $cfg, $db );/* Serving the page as HTML--------------------------------------------------------------------------------------------------------------*/header( "Content-type: text/html" );/* Variables--------------------------------------------------------------------------------------------------------------*/$title = $cfg['CompanyName'] . " - " . date('d m Y'); //attention!: code later custom title addon$copyright = "(c) Copyright " . $cfg['CompanyName'] . " " . date('Y');/* Top XHTML--------------------------------------------------------------------------------------------------------------*/require_once( 'library/top.php' );/* Logo and Information--------------------------------------------------------------------------------------------------------------*/$infot = new mod_text( "systemTop", $cfg, $db );/* Navigation Horizontal--------------------------------------------------------------------------------------------------------------*/$navh = new mod_nav( "systemNavHorizontal", $cfg, $db );$navh -> setPage( $_REQUEST['p'] );/* Page //attention: needs a mod_error( "Inactive"...--------------------------------------------------------------------------------------------------------------*///int page$page = $_REQUEST['p'];//page set?if( !isset( $page ) ){ header( "Location: " . $cfg['path']['base'].$cfg['path']['homepage'] );}//get config$stmt = $db -> prepare( "select ConfigName from page where PagePath = :page" );$stmt -> bindParam( ":page", $page );$stmt -> execute();foreach( $stmt -> fetchAll() as $modcfg ){ $configname = $modcfg["ConfigName"];}$stmt = $db -> prepare( "select ModuleConfigModuleName from moduleconfig where ModuleConfigName = :configname" );$stmt -> bindParam( ":configname", $configname );$stmt -> execute();$ispage = false;foreach( $stmt -> fetchAll() as $modcfg ){ $ispage = true; $pagemodule = $modcfg["ModuleConfigModuleName"];}if( !$ispage ){ echo( "<div class=\"head\"><h1>404</h1></div><div style=\"text-align:center\" class=\"text\">Sorry, the page could not be found.</div>" );}if( isset( $pagemodule ) && !empty( $pagemodule ) ){ eval( "\$" . $pagemodule . " = new " . $pagemodule . "( \$configname, \$cfg, \$db );" );}/* Copyright & Links--------------------------------------------------------------------------------------------------------------*/$infob = new mod_text( "systemFooter", $cfg, $db );/* Bottom XHTML--------------------------------------------------------------------------------------------------------------*/require_once( 'library/bottom.php' );/* Close--------------------------------------------------------------------------------------------------------------*/require_once( 'close.inc.php' );?><?php/* Hardcoded for AutoLoad--------------------------------------------------------------------------------------------------------------*/define("CLASS_DIR", "classes/");define("MODULE_DIR", "modules/"); //attention!: base later on $cfg['path']['module_dir'];$cfg['path']['config_file'] = "config.inc.php";/* Check Configuration File--------------------------------------------------------------------------------------------------------------*///check config filetry{ if( !file_exists( $cfg['path']['config_file'] ) ) { throw new Exception( "", "4001" ); } if( !is_file( $cfg['path']['config_file'] ) ) { throw new Exception( "", "4002" ); } require_once( $cfg['path']['config_file'] );}catch( Exception $e ){ echo $e -> getCode() . "\n";}/* Error Reporting--------------------------------------------------------------------------------------------------------------*///attention!: uncomment // below for security reasons//error_reporting( 0 );/* Exceptions--------------------------------------------------------------------------------------------------------------*/function exception_handler( $exception ){ die( "Uncaught Exception." ); //attention!: do report?}set_exception_handler('exception_handler');/* Autoloading Classes--------------------------------------------------------------------------------------------------------------*/function __autoload( $classname ){ try { if( substr( $classname, 0, 3) === "mod" ) { if( !file_exists( MODULE_DIR . $classname . "/" . "include.php" ) ) { throw new Exception( "", "6101" ); } if( !is_file( MODULE_DIR . $classname . "/" . "include.php" ) ) { throw new Exception( "", "6102" ); } require_once( MODULE_DIR. $classname . "/" . "include.php" ); } else { if( !file_exists( CLASS_DIR . $classname . ".class.php" ) ) { throw new Exception( "", "6101" ); } if( !is_file( CLASS_DIR . $classname . ".class.php" ) ) { throw new Exception( "", "6102" ); } require_once( CLASS_DIR . $classname . ".class.php" ); } } catch( Exception $e ) { ob_clean(); die( "Exception: " . $e->getCode() ); }}/* Regular Checks--------------------------------------------------------------------------------------------------------------*/require_once( 'check.inc.php' );/* Set-up database connection--------------------------------------------------------------------------------------------------------------*/$db = new PDO( $cfg['pdo'], $cfg['db_user'], $cfg['db_pass'], $cfg['pdo_attributes'] );/* Fetch Configuration from Database--------------------------------------------------------------------------------------------------------------*/try{ $query = $db -> prepare("select * from {$cfg['db_tables']['configuration']}"); $query -> execute(); foreach( $query -> fetchAll() as $row ) { $param = $row["ConfigurationParameter"]; $value = $row["ConfigurationValue"]; if( isset( $cfg[$param] ) ) { throw new Exception( "", "4003" ); } $cfg[$param] = $value; }}catch( Exception $e ){ die( "Exception: " . $e -> getCode() . "\n" );}/* Start Output Buffering--------------------------------------------------------------------------------------------------------------*/ob_start();/* Start Session--------------------------------------------------------------------------------------------------------------*/session_start();/* Gather user info for session--------------------------------------------------------------------------------------------------------------*/if( !isset( $_SESSION['user'] ) || empty( $_SESSION['user'] ) ){ //make user $_SESSION['user'] = new User( $_SERVER['REMOTE_ADDR'] ); //attention!: ip itself not safe enough as user identification //set language //attention!: make a automatic language detect $_SESSION['user'] -> setLanguage( "en-US" ); //set useragent $_SESSION['user'] -> setUserAgent( $_SERVER['HTTP_USER_AGENT'] );}/* Create CSS in Session--------------------------------------------------------------------------------------------------------------*/if( !isset( $_SESSION['css'] ) || empty( $_SESSION['css'] ) ){ //make css $_SESSION['css'] = new CSS( $cfg ); $_SESSION['css'] -> load( "basic", $db );}?><?$confinfo = array( "align" => "center", "text" => array( 0 => array( 0 => array( "id" => "InformationLogo", "class" => NULL, "corners" => false, "content" => "" ), 1 => array( "id" => "InformationLinks", "class" => NULL, "corners" => false, "content" => "<ul><li><a href=\"#\">Home</a></li><li><a href=\"#\">Voorwaarden</a></li><li><a href=\"#\">Sitemap</a></li><li><a href=\"#\">Contact</a></li></ul>" ), 2 => array( "id" => "InformationAddress", "class" => NULL, "corners" => false, "content" => "<address>Awarox<br>Rembrandtlaan 22<br>3443EG Woerden<br>info@awarox.com<br>KVK 30227342</address>" ) ) ));$confbottom = array( "align" => "center", "text" => array( 0 => array( 0 => array( "id" => "footer", "class" => NULL, "corners" => false, "content" => "Copyright © Awarox " . date('Y') ) ) ));$confhome = array( "align" => "center", "text" => array( 0 => array( 0 => array( "id" => "Homepage00", "class" => NULL, "corners" => true, "content" => NULL ) ), 1 => array( 0 => array( "id" => "Homepage10", "class" => "head", "corners" => false, "content" => "<h1>Proudly<br>Announcing!</h1>" ), 1 => array( "id" => "Homepage11", "class" => "text", "corners" => false, "content" => "<p>We, Awarox, are proudly announcing the start of our company. This is a dummy-text. We deliver Internet Security services, Penetration Testings and Webapplication-development. Please feel free to browse our website to learn more about our products and services. Have a very special and nice day, the Awarox Security Team. This is a <strong>dummy-text</strong>.</p><p>We, Awarox, are proudly announcing the start of our company. This is a dummy-text. We deliver Internet Security services, Penetration Testings and Webapplication-development. Please feel free to browse our website to learn more about our products and services. Have a very special and nice day, the Awarox Security Team. This is a <strong>dummy-text</strong>.</p>" ) ), 2 => array( 0 => array( "id" => "Homepage20", "class" => "text", "corners" => false, "content" => "<p>We, Awarox, are proudly announcing the start of our company. This is a dummy-text. We deliver Internet Security services, Penetration Testings and Webapplication-development. Please feel free to browse our website to learn more about our products and services. Have a very special and nice day, the Awarox Security Team. This is a <strong>dummy-text</strong>.</p><p>We, Awarox, are proudly announcing the start of our company. This is a dummy-text. We deliver Internet Security services, Penetration Testings and Webapplication-development. Please feel free to browse our website to learn more about our products and services. Have a very special and nice day, the Awarox Security Team. This is a <strong>dummy-text</strong>. We, Awarox, are proudly announcing the start of our company. This is a dummy-text. We deliver Internet Security services, Penetration Testings and Webapplication-development. Please feel free to browse our website to learn more about our products and services. Have a very special and nice day, the Awarox Security Team. This is a <strong>dummy-text</strong>.</p><p>We, Awarox, are proudly announcing the start of our company. This is a dummy-text. We deliver Internet Security services, Penetration Testings and Webapplication-development. Please feel free to browse our website to learn more about our products and services. Have a very special and nice day, the Awarox Security Team. This is a <strong>dummy-text</strong>.</p>" ), 1 => array( "id" => "Homepage21", "class" => "head", "corners" => false, "content" => "<h1>Security is a<br> serious issue.</h1>" ) ) ));$confnav = array( "layout" => "horizontal", "align" => "center", "id" => "NavHorizontal", "class" => NULL, "corners" => true);echo(serialize($confnav));?>