Ninjakreborn Posted May 12, 2010 Share Posted May 12, 2010 class All Tested. // This handle login checking, gateway checking, and permission structuring. function check_login() { // Need to make sure they have a permission level. if (empty($_SESSION['territory']) && empty($_SESSION['area']) && empty($_SESSION['logged']) && empty($_SESSION['membership_level'])) { return false; } if ($_SESSION['logged'] == 1) { return true; }else { return false; } } Config File (Included in every file in the system..this is the file that causes the redirect issue. <?php /* Joyel Portable Framework */ session_start(); // Global session start // variables Edited // Connect to database EDITED // Core Libraries require_once('autoload_classes/functions.class.php'); require_once('autoload_classes/db.class.php'); require_once('autoload_classes/user.class.php'); require_once('autoload_classes/display.class.php'); // Optional Classes - These are optional. They are required here, but they are not instantiated until as needed. require_once('optional_classes/file.class.php'); require_once('optional_classes/math.class.php'); $logged = $user->check_login(); if ($logged == false) { header('Location: gateway.php'); } ?> Now when this script is called in gateway.php <?php require_once('framework/config.php'); .... ?> It throws this error: This webpage has a redirect loop. The webpage at 'edited' has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer. Here are some suggestions: Reload this web page later. Learn more about this problem. More information on this error Any advice? Quote Link to comment https://forums.phpfreaks.com/topic/201568-too-many-redirects/ Share on other sites More sharing options...
Ninjakreborn Posted May 13, 2010 Author Share Posted May 13, 2010 My brain must have been fried. $logged = $user->check_login(); if ($_SERVER['PHP_SELF'] != '/gateway.php') { if ($logged == false) { header('Location: gateway.php'); } } That works..it was on the gateway page and causing this issue. Looks all worked out now, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/201568-too-many-redirects/#findComment-1057471 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.