Location: PHPKode > scripts > GalleryShuffle > v1.0/php/controler.php
<?php
error_reporting(0);
session_start();

header('Content-type: text/html; charset=UTF-8'); 
mb_internal_encoding('UTF-8');

$phpFolder = 'php/';
$modelsFolder = 'Models/';
$viewsFolder = 'Views/';

// Install
if(!file_exists($phpFolder . "CONFIG.php")){
	include($phpFolder . "install.php");
	exit;
}

include($phpFolder . "includes.php");


// DB CONNECT & SINGLETONS
DB::Open(CONFIG::DBname, CONFIG::DBhostAddress, CONFIG::DBhostPort, CONFIG::DBuserName, CONFIG::DBpassword);

LANG::createSingleton(CONFIG::lang);
$LANG = LANG::getSingleton();

// >> BEGIN
FUNCTIONS::encodePost();
FUNCTIONS::encodeGet();

$isLogged = false;

// if logged in ?

if(isset($_SESSION['userLogUID']) && $_SESSION['userLogUID'] != NULL){
	
	$model_userLogs = new model_userLogs();
	
	if(isset($_GET['admindisconnect']) && $_GET['admindisconnect'] == 1){
		
		$model_userLogs->updateNoActiveLineByUid($_SESSION['userLogUID']);
		session_destroy();
		session_start();
		$_SESSION['imageAccessUID'] = CONFIG::imageAccessUID;
		
	}else if($model_userLogs->verifyIsActiveLineByUid($_SESSION['userLogUID'])){
		
		$model_userLogs->updateLineByUid($_SESSION['userLogUID']);
		$_SESSION['imageAccessUID'] = CONFIG::imageAccessUID;
		$isLogged = true;
		
	}else{
	
		$model_userLogs->updateNoActiveLineByUid($_SESSION['userLogUID']);
		session_destroy();
		echo "<script>window.location.href='index.php';</script>";
		
	}
	
}else{

	if(isset($_GET['action']) && FUNCTIONS::decrypte($_GET['action']) == 'adminconnection' && isset($_POST['mail']) && isset($_POST['password'])){
		
		if($_POST['mail'] == CONFIG::userLogin && $_POST['password'] == CONFIG::userPassword){
			
			$model_userLogs = new model_userLogs();
			
			$uid = uniqid('', true);
			
			$model_userLogs->insertNewLine($uid, $_SERVER['REMOTE_ADDR']);
			
			$_SESSION['userLogUID'] = $uid;
			
			echo $LANG->traduc['connectionSuccess'] . "
			<script>
			var timer = setInterval( function(evt) {
				window.location.href='index.php';
			}, 1000);
			</script>";
	
		}else{
			
			echo $LANG->traduc['connectionBadPost'];
			
			
		}
		
		return;
		
	}
}


// Admin Controler
if(isset($_GET['action']) && $_GET['action'] != NULL){
	
	$string = FUNCTIONS::decrypte($_GET['action']);
	
	preg_match_all('/[a-z]+/', $string, $actions);
	preg_match_all('/[0-9]+/', $string, $values);
	
	//echo '<b>Actions : </b>'; print_r($actions[0]); echo '<br /><b>Values : </b>'; print_r($values[0]);

}else{

	$_GET['action'] = 'none';
	$actions[0][0] = 'none';

}

if($isLogged) include($phpFolder . 'controlerBack.php');
else include($phpFolder . 'controlerFront.php');



?>
Return current item: GalleryShuffle