So I'm working on setting up my first "fancy" page system, and I have run into a problem. I use the code seen below, and it loads the "profile" page without any problems, and the default page works fine too. However the other two pages does not show at all, and I can't seem to request them in the URL eighter. All the files are there tho. Any help here will be much appreciated! :)
if(isset($_SESSION['user_id'])){
require('user.php');
$player = new user($_SESSION['user_id'], $database);
$default_page = 'profile';
$pages = array(
'profile' => array(
'name' => 'Profile',
'file' => 'profile.php',
'function' => 'profile',
),
'create_monster' => array(
'name' => 'Create Monster',
'file' => 'monsterPages.php',
'function' => 'createMonster',
),
'create_attack' => array(
'name' => 'Create Attack',
'file' => 'attackPages.php',
'function' => 'createAttack',
),
);
if(!empty($_GET['page'])){
$page = strtolower(trim($_GET['page']));
if(isset($pages[$page])){
require($pages[$page]['file']);
echo "<p class='pageTitle'>" . $pages[$page]['name'] . "</p>";
$pages[$page]['function']();
}
else{
require($pages[$default_page]['file']);
echo "<p class='pageTitle'>" . $pages[$default_page]['name'] . "</p>";
$pages[$default_page]['function']();
}
}
else{
require($pages[$default_page]['file']);
echo "<p class='pageTitle'>" . $pages[$default_page]['name'] . "</p>";
$pages[$default_page]['function']();
}
}