Jump to content

Too Many Redirects


Ninjakreborn

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.