From 20347b6b2a118da1d80750b7f3f8f3f833266225 Mon Sep 17 00:00:00 2001 From: Quitta Date: Sat, 29 Jun 2013 05:23:38 +0200 Subject: [PATCH] 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 --- .../www/html/css/bootstrap-cerulean.css | 1 + .../www/html/{inc => func}/add_user.php | 0 .../www/html/{inc => func}/login.php | 0 .../www/html/{autoload => inc}/logout.php | 0 .../tools/server/ryzom_ams/www/html/index.php | 26 ++++++++++--------- .../ryzom_ams/www/html/templates/userlist.tpl | 1 - 6 files changed, 15 insertions(+), 13 deletions(-) rename code/ryzom/tools/server/ryzom_ams/www/html/{inc => func}/add_user.php (100%) rename code/ryzom/tools/server/ryzom_ams/www/html/{inc => func}/login.php (100%) rename code/ryzom/tools/server/ryzom_ams/www/html/{autoload => inc}/logout.php (100%) diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/css/bootstrap-cerulean.css b/code/ryzom/tools/server/ryzom_ams/www/html/css/bootstrap-cerulean.css index 82037d419..57716d2f7 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/css/bootstrap-cerulean.css +++ b/code/ryzom/tools/server/ryzom_ams/www/html/css/bootstrap-cerulean.css @@ -4451,3 +4451,4 @@ i[class^="icon-"] { .invisible { visibility: hidden; } + diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/add_user.php b/code/ryzom/tools/server/ryzom_ams/www/html/func/add_user.php similarity index 100% rename from code/ryzom/tools/server/ryzom_ams/www/html/inc/add_user.php rename to code/ryzom/tools/server/ryzom_ams/www/html/func/add_user.php diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/login.php b/code/ryzom/tools/server/ryzom_ams/www/html/func/login.php similarity index 100% rename from code/ryzom/tools/server/ryzom_ams/www/html/inc/login.php rename to code/ryzom/tools/server/ryzom_ams/www/html/func/login.php diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/autoload/logout.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/logout.php similarity index 100% rename from code/ryzom/tools/server/ryzom_ams/www/html/autoload/logout.php rename to code/ryzom/tools/server/ryzom_ams/www/html/inc/logout.php diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/index.php b/code/ryzom/tools/server/ryzom_ams/www/html/index.php index dfd194049..50d519157 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/index.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/index.php @@ -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'])){ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/userlist.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/userlist.tpl index d5e076161..59cb17574 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/userlist.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/userlist.tpl @@ -13,7 +13,6 @@

The shard/lib/web db user list You are about to see it here!

-
lolbol