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

--HG--
branch : quitta-gsoc-2013
hg/feature/sse2
Quitta 12 years ago
parent 4034c83382
commit a3b3dbd59c

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

@ -5,14 +5,6 @@ require( '../config.php' );
require( '../../ams_lib/libinclude.php' ); require( '../../ams_lib/libinclude.php' );
session_start(); 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 //Decide what page to load
if(isset($_SESSION['user'])){ if(isset($_SESSION['user'])){
$page = 'home'; $page = 'home';
@ -22,18 +14,28 @@ if(isset($_SESSION['user'])){
$page = 'login'; $page = 'login';
} }
if ( isset( $_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"]; $page = $_GET["page"];
} }
function loadpage ( $page ){
/*function loadpage ( $page ){
$filename = 'autoload/' . $page . '.php'; $filename = 'autoload/' . $page . '.php';
if(is_file($filename)){ if(is_file($filename)){
require_once($filename); require_once($filename);
} }
} }
loadpage($page); loadpage($page);*/
//Set permission //Set permission
if(isset($_SESSION['permission'])){ if(isset($_SESSION['permission'])){

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

Loading…
Cancel
Save