commit
0984bc4c25
@ -1,39 +1,51 @@
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 'on');
|
||||
require( '../config.php' );
|
||||
require( '../../ams_lib/libinclude.php' );
|
||||
//default page
|
||||
$page = 'login';
|
||||
session_start();
|
||||
|
||||
print("[" . $_SESSION['user'] . "] ");
|
||||
|
||||
//Decide what page to load
|
||||
if(isset($_SESSION['user'])){
|
||||
$page = 'home';
|
||||
}else{
|
||||
//default page
|
||||
$page = 'login';
|
||||
}
|
||||
|
||||
|
||||
if ( isset( $_GET["page"] ) ){
|
||||
$page = $_GET["page"];
|
||||
}
|
||||
|
||||
//perform an action in case one is specified
|
||||
if ( isset( $_POST["function"] ) ){
|
||||
require( "inc/" . $_POST["function"] . ".php" );
|
||||
$tempReturn = $_POST["function"]();
|
||||
$functionReturn = array_merge($tempReturn,$_POST);
|
||||
if ( isset($_POST["callBack"])){
|
||||
$page = $_POST["callBack"];
|
||||
|
||||
}
|
||||
$return = $_POST["function"]();
|
||||
}
|
||||
|
||||
|
||||
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';
|
||||
//Set permission
|
||||
if(isset($_SESSION['Permission'])){
|
||||
$return['permission'] = $_SESSION['Permission'];
|
||||
}else{
|
||||
//default permission
|
||||
$return['permission'] = 0;
|
||||
}
|
||||
|
||||
if ( isset($functionReturn) ){
|
||||
$return = array_merge(array( 'permission' => 1, 'no_visible_elements' => $no_visible_elements ),$functionReturn);
|
||||
|
||||
//hide sidebar + topbar in case of login/register
|
||||
if($page == 'login' || $page == 'register'){
|
||||
$return['no_visible_elements'] = 'TRUE';
|
||||
}else{
|
||||
$return = array( 'permission' => 1, 'no_visible_elements' => $no_visible_elements );
|
||||
$return['no_visible_elements'] = 'FALSE';
|
||||
}
|
||||
//print_r($return);
|
||||
|
||||
helpers :: loadTemplate( $page , $return );
|
||||
|
||||
session_destroy();
|
||||
|
@ -1,44 +0,0 @@
|
||||
<?php
|
||||
$no_visible_elements=true;
|
||||
include('header.php'); ?>
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="span12 center login-header">
|
||||
<img src="img/mainlogo.png"/>
|
||||
</div><!--/span-->
|
||||
</div><!--/row-->
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="well span5 center login-box">
|
||||
<div class="alert alert-info">
|
||||
Please login with your Username and Password.
|
||||
</div>
|
||||
<form class="form-horizontal" action="index.php" method="post">
|
||||
<fieldset>
|
||||
<div class="input-prepend" title="Username" data-rel="tooltip">
|
||||
<span class="add-on"><i class="icon-user"></i></span><input autofocus class="input-large span10" name="username" id="username" type="text" value="" />
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<div class="input-prepend" title="Password" data-rel="tooltip">
|
||||
<span class="add-on"><i class="icon-lock"></i></span><input class="input-large span10" name="password" id="password" type="password" value="" />
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<div class="input-prepend">
|
||||
<label class="remember" for="remember"><input type="checkbox" id="remember" />Remember me</label>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<p class="center span5">
|
||||
<button type="submit" class="btn btn-primary">Login</button>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
<div class="alert alert-info">
|
||||
<strong>Register</strong>
|
||||
If you dont have an account yet, create one <a href="register.php">here</a>!
|
||||
</div>
|
||||
</div><!--/span-->
|
||||
</div><!--/row-->
|
||||
<?php include('footer.php'); ?>
|
@ -0,0 +1,19 @@
|
||||
CREATE DATABASE IF NOT EXISTS `ryzom_ams`;
|
||||
USE `ryzom_ams`;
|
||||
DROP TABLE IF EXISTS ams_user;
|
||||
DROP TABLE IF EXISTS ams_querycache;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `ams_user` (
|
||||
`UId` int(10) NOT NULL AUTO_INCREMENT,
|
||||
`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';
|
||||
|
||||
CREATE TABLE ams_querycache (
|
||||
`SID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
|
||||
`type` VARCHAR( 64 ) NOT NULL ,
|
||||
`query` VARCHAR( 512 ) NOT NULL
|
||||
);
|
Loading…
Reference in New Issue