Exemplo n.º 1
0
<?php

//Si PAGE est non null et numéric
if (isset($_GET['PAGE']) && is_numeric($_GET['PAGE'])) {
    //On récupère les pages disponnible en base de données
    $req = "SELECT PAGE_NAME, PAGE_LINK, PAGE_INDEX, PAGE_VISIBLE, PAGE_SHOWLOGGED, PAGE_RANK_VALUE FROM " . $Config["SQL"]["BASE"] . ".PAGE";
    $stmt = $bdd->query($req);
    while ($donnees = $stmt->fetch(PDO::FETCH_ASSOC)) {
        if ($_GET['PAGE'] == $donnees['PAGE_INDEX']) {
            if (is_Login()) {
                if ($_SESSION['RANK'] >= $donnees['PAGE_RANK_VALUE']) {
                    if ($donnees['PAGE_SHOWLOGGED'] == 1 || $donnees['PAGE_SHOWLOGGED'] == 2) {
                        include_once $Config["SCRIPT_LINK"]["PHP"] . $donnees['PAGE_LINK'];
                    }
                }
            } else {
                if ($donnees['PAGE_RANK_VALUE'] == 0) {
                    if ($donnees['PAGE_SHOWLOGGED'] == 0 || $donnees['PAGE_SHOWLOGGED'] == 2) {
                        include_once $Config["SCRIPT_LINK"]["PHP"] . $donnees['PAGE_LINK'];
                    }
                }
            }
        }
    }
} else {
    header("location:?PAGE=0");
}
unset($bddInsert);
Exemplo n.º 2
0
<?php

//Si l'utilisateur n'est pas connecté
if (!is_Login()) {
    //Si les champs sont remplie
    if (isset($_POST['LOGIN']) && isset($_POST['PASS'])) {
        //On stoque et sécurise les valeurs des champs dans des variables
        $login = md5(htmlentities(strip_tags($_POST['LOGIN'])));
        $pass = md5(htmlentities(strip_tags($_POST['PASS'])));
        $req = "SELECT USER.USER_ID, USER.USER_RANK_VALUE, USER.USER_NAME, USER.USER_FIRSTNAME, USER.USER_BAN FROM " . $Config["SQL"]["BASE"] . ".USER WHERE USER_LOGIN=PASSWORD(?) AND USER_PASS=PASSWORD(?)";
        $stmt = $bdd->prepare($req);
        $stmt->execute(array($login, $pass));
        $ligne = $stmt->fetch(PDO::FETCH_ASSOC);
        if (intval($ligne) === 1) {
            //Si l'utilisateur n'est pas banni
            if (intval($ligne['USER_BAN']) == 0) {
                $_SESSION['ID'] = $ligne['USER_ID'];
                $_SESSION['RANK'] = $ligne['USER_RANK_VALUE'];
                session_regenerate_id();
                header("location:?PAGE=0");
            } else {
                echo "<p>Votre compte est banni, vous ne pouvez pas avoir accès au site.</p>";
            }
        } else {
            echo "<p>Identifiant ou mot de passe incorrect !</p>";
        }
    }
    ?>
		<form method="POST">
			<label>Identifiant : 
				<input type="TEXT" name="LOGIN" required>