Okay; so let's first restore some sanity to the indenting:
if (isset($_GET['id']) || $_GET['cat'])
{
if($_GET['id'] == 'text/stuff' && $_GET['cat'] == '1' && $_GET['page'] == 'jokes') {
include("text_stuff/jokes.php");
}
elseif($_GET['id'] == 'text/stuff' && $_GET['cat'] == '1' && $_GET['page'] == 'dirty') {
include("text_stuff/dirty.php");
}
// *** stuff *** //
elseif($_GET['id'] == 'text/stuff') {
if($_GET['cat'] == '2' && $_GET['page'] == 'ucca') {
include("text_stuff/ucca.php");
}
elseif($_GET['cat'] == '2' && $_GET['page'] == 'ucca' && $_GET['num'] == '2') {
include("text_stuff/ucca_2.php");
}
} else {
include("text_stuff/home.php");
}
} else {
print "You have not specified the page.";
}
So the first thing that's apparent is if $GET['cat']=='2' and $GET['page']=='ucca', then "text_stuff/ucca.php" will be loaded; $GET['num'] will never be looked at.
// $_GET['page']=='ucca' is true, and $_GET['page']=='dirty' is false, etc.
if (isset($_GET['id']) || $_GET['cat'])
{
if($_GET['id'] == 'text/stuff' && false && false) {
include("text_stuff/jokes.php");
}
elseif($_GET['id'] == 'text/stuff' && false && false) {
include("text_stuff/dirty.php");
}
// *** stuff *** //
elseif($_GET['id'] == 'text/stuff') {
if(true && true) {
include("text_stuff/ucca.php");
}
elseif(true && true && $_GET['num'] == '2') {
include("text_stuff/ucca_2.php");
}
} else {
include("text_stuff/home.php");
}
} else {
print "You have not specified the page.";
}
//Simplify the true and false statements ==>
if (isset($_GET['id']) || $_GET['cat'])
{
if($_GET['id'] == 'text/stuff') {
include("text_stuff/ucca.php");
} else {
include("text_stuff/home.php");
}
} else {
print "You have not specified the page.";
}
What's the other one? Oh, just "id=text/stuff", with everything else unset.
if (true || false)
{
if(true && false && false) {
include("text_stuff/jokes.php");
}
elseif(true && false && false) {
include("text_stuff/dirty.php");
}
// *** stuff *** //
elseif(true) {
if(false && false) {
include("text_stuff/ucca.php");
}
elseif(false && false && false) {
include("text_stuff/ucca_2.php");
}
} else {
include("text_stuff/home.php");
}
} else {
print "You have not specified the page.";
}
//==>
/* It simplifies down to nothing at all! */
It is a very complicated process you're going through there. Have you considered scrapping it and starting again with something cleaner? I don't think it would be worth the hassle of moving all those tests up and down so that they're evaluated in the right order and walking through every possible decision path to make sure it ends up at the right spot, just to get something to work that would need the whole thing done again the moment anything changes.
Couple more things: the '/' in 'text/stuff' is dodgy (makes for malformed URLs) and an alternative should be considered. Also, you're not checking for the existence of $GET['cat'], $GET['age'] or $_GET['num']