Hello all,
If there is someone else trying to make use of the template system and add the user system to it please let me know..
Right now I'm working on getting the two init.inc.php files into one, after working with it for some hours I got this.
<?php
session_start();
// include the home page from start when landing on index.php
if (empty($_GET['page'])){
header('location: ?page=home');
die ();
}
$core_path = dirname(__FILE__);
// because of the loop in the new init file I had to set a if(!function_exists('function_name')){
function function_name()
}
include ("{$core_path}/inc/user.inc.php");
$data_host = localhost;
$data_user = root;
$data_pass = ;
mysql_connect($data_host, $data_user, $data_pass);
mysql_select_db('Intesira_level_system_date');
// I made a exception to index to because thats the landing page and it will redirect to home which should be the main page.
$exceptions = array('index', 'login', 'register','home','activation');
$pages = scandir("{$core_path}/pages");
unset($pages['0'], $pages['1']);
foreach ($pages as &$page){
$page = substr($page, 0, strpos($page, '.'));
}
if (in_array($_GET['page'], $pages)){
$include_file = "{$core_path}/pages/{$_GET['page']}.page.inc.php";
}else{
$include_file = "{$core_path}/pages/home.page.inc.php";
}
if (isset($_COOKIE['username'], $_COOKIE['password']) && isset($_SESSION['email']) === false){
if (vaild_credentials($_COOKIE['email'], $_COOKIE['password'])){
$_SESSION['email'] = htmlentities($_COOKIE['email']);
setcookie('email', $_COOKIE['email'], time() + 604800);
setcookie('password', $_COOKIE['password'], time() + 604800);
}
}
// I'm sure we could make this login check in the validated $_GET statement just don't know how yet.
if (in_array($_GET['page'], $exceptions) === false){
if(isset($_SESSION['email']) === false){
header('location: ?page=home');
die();
}
}
?>
I really like to be able to use the template system with the login because it will make my life much easier if I can include the header & footer on the index page and just load the content in the include_file.
And I believe its more pro haha
I should say I get it working with the pages now and the session I just can't log in using the login file I could show it here to but lets start with the init file.
Best regards
Wizzuriz
Please let me know if you have a idea on how to make this work.