I'm having a problem integrating the user system with the template system...When I load up a page I keep getting the redirect loop error...I have looked through the code but have no idea what is causing the error.
Below is my init.inc.php file.
<?php session_start(); if (empty($_GET['page'])) { header('Location: home'); die(); } $core_path = dirname(__FILE__); $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"; } //login starts below $exceptions = array('register', 'login'); //$page1 = substr(end(explode('/', $_SERVER['SCRIPT_NAME'])), 0, -4); if (in_array($include_file, $exceptions) === false){ if (isset($_SESSION['username']) === false){ header('Location: login'); die(); } } mysql_connect('localhost', 'user', 'pass'); mysql_select_db('db'); $path = dirname(__FILE__); include("{$path}/core/user.inc.php"); ?>Anyone know whats wrong :S
Thanks,
Saycey