Page 1 of 1

include script - the page loads forever..

Posted: Mon May 11, 2009 4:16 pm
by JKM
I've got an include script that looks like this:

Code: Select all

if($_GET['page'] == 'page1') {
    include('page1.php');
} elseif($_GET['page'] == 'settings') {
    include('settings.php');
} elseif($_GET['page'] == 'info') {
    include('info.php');
} else {
    include('404.php');
}
settings.php got the following at the top:

Code: Select all

<?php
session_start();
if(!$_SESSION['user']) {
    header("Location: index.php");
    die();
} elseif((!is_numeric($_GET['userID'])) || (strlen($_GET['userID']) == 0)) {
    header("Location: main.php");
    die();
} else {
    if($_SESSION['admin_id'] != $_GET['userID']) {
        if($_SESSION['access'] < 2) {
            // Carry on!
        } else {
            header("Location: main.php?page=settings&userID=".$_SESSION['admin_id']);
            die();
        }?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">...
When I added

Code: Select all

if($_SESSION['admin_id'] != $_GET['userID']) {
        if($_SESSION['access'] < 2) {
            // Carry on!
        } else {
            header("Location: main.php?page=settings&userID=".$_SESSION['admin_id']);
            die();
        }
    }
The page loads forever (EXCEPT when I'm viewing the page with settings.php?userID=XXX (only when I'm using main.php?page=settings&userID=XXX!)). Originally, I used this code, but the same problem occured:

Code: Select all

<?php
session_start();
if(!$_SESSION['user']) {
    header("Location: index.php");
    die();
} elseif((!is_numeric($_GET['userID'])) || (strlen($_GET['userID']) == 0)) {
    header("Location: main.php");
    die();
} elseif(($_SESSION['admin_id'] != $_GET['userID']) && ($_SESSION['access'] < 2))  {
    header("Location: main.php?page=settings&userID=".$_SESSION['admin_id']);
    die();
} else {?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">...

Re: include script - the page loads forever..

Posted: Tue May 12, 2009 4:45 am
by JKM
Anyone? I really want this problem to be fixed!