Changed the way index handles page requests, also made a folder func, for when a form is submitted and requires a function to be performed and inc for pages that want to perform php code but without a form

This commit is contained in:
Quitta 2013-06-29 05:23:38 +02:00
parent 193a5843b0
commit beefbe03f8
6 changed files with 15 additions and 13 deletions

View file

@ -4451,3 +4451,4 @@ i[class^="icon-"] {
.invisible {
visibility: hidden;
}

View file

@ -5,14 +5,6 @@ require( '../config.php' );
require( '../../ams_lib/libinclude.php' );
session_start();
//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';
@ -22,18 +14,28 @@ if(isset($_SESSION['user'])){
$page = 'login';
}
if ( isset( $_GET["page"] ) ){
$page = $_GET["page"];
//perform an action in case one is specified
//else check if a php page is included in the inc folder, else just set page to the get param
if ( isset( $_POST["function"] ) ){
require( "func/" . $_POST["function"] . ".php" );
$return = $_POST["function"]();
}else if ( isset( $_GET["page"] ) ){
$filename = 'inc/' . $_GET["page"] . '.php';
if(is_file($filename)){
require_once($filename);
}
$page = $_GET["page"];
}
function loadpage ( $page ){
/*function loadpage ( $page ){
$filename = 'autoload/' . $page . '.php';
if(is_file($filename)){
require_once($filename);
}
}
loadpage($page);
loadpage($page);*/
//Set permission
if(isset($_SESSION['permission'])){

View file

@ -13,7 +13,6 @@
</div>
<div class="box-content">
<p><strong>The shard/lib/web db user list</strong> You are about to see it here!</p>
<div id='test1'> lolbol</div>
<div class="clearfix"></div>
</div>