mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-27 01:26:30 +00:00
Reworked index.php a little, though something is going wrong with my session variables
This commit is contained in:
parent
fa7afa87fd
commit
ed483da085
3 changed files with 38 additions and 18 deletions
|
@ -335,6 +335,9 @@ class Users{
|
|||
if($hashed_input_pass == $row['Password']){
|
||||
//handle successful login
|
||||
print("nice welcome!");
|
||||
$_SESSION['user'] = $params['name'];
|
||||
$_SESSION['permission'] = $row['Permission'];
|
||||
print( $_SESSION['user']);
|
||||
return "success";
|
||||
}else{
|
||||
//handle login failure
|
||||
|
|
|
@ -3,33 +3,49 @@ error_reporting(E_ALL);
|
|||
ini_set('display_errors', 'on');
|
||||
require( '../config.php' );
|
||||
require( '../../ams_lib/libinclude.php' );
|
||||
//default page
|
||||
$page = 'login';
|
||||
session_start();
|
||||
|
||||
|
||||
if ( isset( $_POST["function"] ) ){
|
||||
require( "inc/" . $_POST["function"] . ".php" );
|
||||
$tempReturn = $_POST["function"]();
|
||||
print("[" . $_SESSION['user'] . "] ");
|
||||
|
||||
//Decide what page to load
|
||||
if(isset($_SESSION['user'])){
|
||||
$page = 'home';
|
||||
}else{
|
||||
//default page
|
||||
$page = 'login';
|
||||
}
|
||||
|
||||
function loadpage ( $page ){
|
||||
require_once( 'autoload/' . $page . '.php' );
|
||||
}
|
||||
|
||||
if ( isset( $_GET["page"] ) ){
|
||||
$page = $_GET["page"];
|
||||
}
|
||||
|
||||
//Page Handling
|
||||
if($page == 'login' || $page == 'register'){
|
||||
$no_visible_elements = 'TRUE';
|
||||
//perform an action in case one is specified
|
||||
if ( isset( $_POST["function"] ) ){
|
||||
require( "inc/" . $_POST["function"] . ".php" );
|
||||
$return = $_POST["function"]();
|
||||
}
|
||||
|
||||
if ( isset($functionReturn) ){
|
||||
$return = array_merge(array( 'permission' => 1, 'no_visible_elements' => $no_visible_elements ),$functionReturn);
|
||||
}else{
|
||||
$return = array( 'permission' => 1, 'no_visible_elements' => $no_visible_elements );
|
||||
|
||||
function loadpage ( $page ){
|
||||
require_once( 'autoload/' . $page . '.php' );
|
||||
}
|
||||
|
||||
//Set permission
|
||||
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'){
|
||||
$return['no_visible_elements'] = 'TRUE';
|
||||
}else{
|
||||
$return['no_visible_elements'] = 'FALSE';
|
||||
}
|
||||
//print_r($return);
|
||||
|
||||
helpers :: loadTemplate( $page , $return );
|
||||
|
||||
session_destroy();
|
||||
|
|
|
@ -8,6 +8,7 @@ CREATE TABLE IF NOT EXISTS `ams_user` (
|
|||
`Login` varchar(64) NOT NULL DEFAULT '',
|
||||
`Password` varchar(13) DEFAULT NULL,
|
||||
`Email` varchar(255) NOT NULL DEFAULT '',
|
||||
`Permission` int(3) NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (`UId`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='contains all users information for ryzom_ams';
|
||||
|
||||
|
|
Loading…
Reference in a new issue