caching = 0; $smarty->setTemplateDir('site/template'); $smarty->setCompileDir('site/cache/'); $smarty->setCacheDir('site/cache/'); /** * start a session * we only use cookies and do not allow the overwrite via get or post */ if(ini_set('session.use_only_cookies',true) === false || ini_set('session.cookie_httponly',true) === false || ini_set('session.use_cookies',true) === false) { die('Cant use session cookies'); } $garbage_timeout = SESSION_LIFETIME + 300; ini_set('session.gc_maxlifetime', $garbage_timeout); // the % rate how often the session.gc is run // http://de.php.net/manual/en/session.configuration.php#ini.session.gc-probability ini_set('session.gc_probability',10); // 100 = everytime = 100% session_set_cookie_params(SESSION_LIFETIME); session_name(SESSION_NAME); session_start(); session_regenerate_id(true); /** * database connection * wihtout it it would be not working */ require('./conf/db.php'); $mysql_con = mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) OR die('Datenbankserver nicht erreichbar'); $mysql_sel = mysql_select_db(DB_DATABASE,$mysql_con) OR die('Datenbank konnte nicht selektiert werden'); mysql_query("SET NAMES 'utf8'"); // the main varible to store the data for the template $data = array(); // load the script file if($includeFile !== false) { require($includeFile); } // the template we are using now to load the css and stuff correctly $smarty->assign(array('template_dir' => WEBROOT_PATH.'/site/template', 'img_path' => WEBROOT_PATH.'/site/template/img', 'template' => $template, 'data' => $data)); if(!empty($data['_setHeader'])) { // this comes from the individual pages header($data['_setHeader']); } header('Content-type: text/html; charset=UTF-8'); header("Date: ".gmdate("D, d M Y H:i:s", time())." GMT"); header("Last-Modified: ".gmdate("D, d M Y H:i:s", time())." GMT"); $smarty->display('main.html'); ?>