include script - the page loads forever..

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
JKM
Forum Contributor
Posts: 221
Joined: Tue Jun 17, 2008 8:12 pm

include script - the page loads forever..

Post 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">...
JKM
Forum Contributor
Posts: 221
Joined: Tue Jun 17, 2008 8:12 pm

Re: include script - the page loads forever..

Post by JKM »

Anyone? I really want this problem to be fixed!
Post Reply