/** * set the view path from the requesturi * @return string */ public function dispatch() { // routage switch ($this->requestUri) { case "/pos": case "/trace": $this->viewPath = APP::WEBROOT . $this->requestUri . ".php"; break; case "/log": $this->viewPath = APP::WEBROOT . "/log/index.php"; break; case "/js/restpostgis/v1/ws_geo_attributequery.php": case "/log/index.php": case "/log/ajaxLogin.php": case "/log/home.php": case "/log/logout.php": case "/sms/envoi_sms.php": case "/traitement/success.php": $this->viewPath = APP::WEBROOT . $this->requestUri; break; default: if (!User::isConnected()) { $this->viewPath = APP::WEBROOT . "/log/index.php"; } else { $this->viewPath = APP::WEBROOT . "/APIE.php"; } break; } return $this->viewPath; }
public static function getFullName() { if (User::isConnected()) { return ucfirst($_SESSION['firstName']) . ' ' . ucfirst($_SESSION['lastName']); } else { return ''; } }
/** * Constructeur * @param string $title Le titre de la page */ public function __construct($title) { $this->title = $title; if (!User::isConnected()) { //Gérer le div d'authentification et Gérer menus annexes $auth = ""; $this->options = ""; } else { $auth = ""; } }
function connexion() { if (!User::isConnected()) { include VIEW . "connexion.php"; if (isset($_POST['login'])) { echo "<p id='mErreur'>Mot de passe ou login erroné</p>"; } } else { index(); } }
require_once './php/database.php'; $routes = array('home', 'profile', 'go', 'add', 'addToDB', 'game', 'signup', 'signin', 'signout'); $requestURI = explode('/', $_SERVER['REQUEST_URI']); $scriptName = explode('/', $_SERVER['SCRIPT_NAME']); for ($i = 0; $i < sizeof($scriptName); $i++) { if ($requestURI[$i] == $scriptName[$i]) { unset($requestURI[$i]); } } $requestURI = array_values($requestURI); @($action = $requestURI[0]); $params = array_slice($requestURI, 1); if (empty($action)) { $action = "home"; } if (($action == 'game' || $action == 'go') && !User::isConnected()) { //if not connected he can see only home setAlert('warning', 'in order to play please sign in first'); header('location: /home'); exit(0); } //why not, i think he should be able to see home if he's connected... if ($action == 'gameMaker') { //it looks ugly but hey, it works require_once "./php/gameMaker.php"; exit(0); } ?> <!DOCTYPE HTML> <html> <head>
$('#FormConnection').submit(); Messenger().post({ message: 'Bonjour ' + sUserName, type: 'success' }); } else { Messenger().post({ message: 'Prénom inexistant', type: 'error' }); } } }); }); <?php if (User::isConnected()) { ?> // au click du bouton "Clore les votes" $('#CloseVoteID').click(function () { $.ajax({ url: '<?php echo BASEPATH; ?> /vote/php_close.php?userCode=<?php echo $sUserCode; ?> ', success: function (sPoolResult) { // Si on reçoit le résultat du sondage if (sPoolResult) { // on remplit le conteneur principal avec le résultat du sondage
public function includeHeader() { if (User::isConnected()) { include VIEW . "headerConnecte.php"; } else { include VIEW . "headerDeconnecte.php"; } }