I think you'll see the problem if you simplify the code first (and use some indentation):
if (!$page) {
include 'home.php';
} elseif (file_exists($page.".php")) {
switch ($page) {
case 'xxx:
// do something
break;
default:
// do something;
}
} else {
include '404.php';
}
switch ($u) {
case 'reflex':
include 'profiles/reflex.php';
break;
default:
include '404.php';
}
so....
if there is no $page, include home.php, then if there is no $u do the default case, which is include 404.php.
if there is a $page, include pagexxx.php, then if there is no $u do the default case, which is include 404.php.
if there is a $page, but the file does not exist, include 404.php, then if there is a user name is reflex include 404.php.
if there is a $page, but the file does not exist, include 404.php, then if there is no user include 404.php again.
You have some serious logic errors going on there.