khanat-code-old/code/ryzom/tools/server/ryzom_ams/www/html/index.php

55 lines
1.2 KiB
PHP
Raw Normal View History

2013-06-17 14:03:24 +00:00
<?php
error_reporting(E_ALL);
ini_set('display_errors', 'on');
2013-06-17 14:03:24 +00:00
require( '../config.php' );
require( '../../ams_lib/libinclude.php' );
session_start();
2013-06-17 14:03:24 +00:00
2013-06-26 01:26:25 +00:00
//print_r($_SESSION);
//perform an action in case one is specified
if ( isset( $_POST["function"] ) ){
require( "inc/" . $_POST["function"] . ".php" );
$return = $_POST["function"]();
}
//Decide what page to load
if(isset($_SESSION['user'])){
$page = 'home';
$return['username'] = $_SESSION['user'];
}else{
//default page
$page = 'login';
}
if ( isset( $_GET["page"] ) ){
$page = $_GET["page"];
}
2013-06-17 14:03:24 +00:00
function loadpage ( $page ){
$filename = 'autoload/' . $page . '.php';
if(is_file($filename)){
require_once($filename);
}
}
2013-06-17 14:03:24 +00:00
loadpage($page);
//Set permission
2013-06-26 01:26:25 +00:00
if(isset($_SESSION['permission'])){
$return['permission'] = $_SESSION['permission'];
}else{
//default permission
$return['permission'] = 0;
}
//hide sidebar + topbar in case of login/register
if($page == 'login' || $page == 'register' || $page == 'logout'){
$return['no_visible_elements'] = 'TRUE';
}else{
$return['no_visible_elements'] = 'FALSE';
}
2013-06-26 01:26:25 +00:00
//print_r($return);
2013-06-17 14:03:24 +00:00
helpers :: loadTemplate( $page , $return );