function verifyUser()
{
    if (!userIsLogged()) {
        $_SESSION['danger'] = "You don't have access, please log in.";
        header("Location: index.php");
        die;
    }
}
Ejemplo n.º 2
0
    global $db_vue_rm;
    $html = "\n\t<table width='98%'>\n\t<tr class='mh_tdpage'>\n\t\t<td align='left' class='mh_tdtitre'> Vous êtes connecté aux outils R&amp;M </td>\n\t\t<td align='right' class='mh_tdtitre'> <input type='button' onClick='deconn();' name='logout' value='déconnexion' class='mh_form_submit'></input> </td>\n\t</tr>\n\t</table>\n\t";
    echo "document.getElementById('conn').innerHTML={$html};";
}
// ----------------------------------------
// Main
// ----------------------------------------
$numTroll = $_REQUEST['numTroll'];
$password = $_REQUEST['password'];
$submitLogout = $_REQUEST['logout'];
$submitLogin = $_REQUEST['login'];
$autologin = $_COOKIE['autologin'];
$URLStylesheet = $_GET['URLStylesheet'];
$msg = '';
// UTILISATEUR LOGGE
if (userIsLogged()) {
    if ($submitLogout) {
        userLogout();
        setcookie('autologin', false, time() + 365 * 24 * 3600, '/');
        displayFormLogin("Vous devez vous authentifier pour utiliser les outils R&amp;M", true);
    } else {
        displayFormLogout();
    }
} else {
    if (isset($_REQUEST['numTroll']) && isset($_REQUEST['password'])) {
        setcookie('autologin', $_REQUEST['autologin'], time() + 365 * 24 * 3600, '/');
        $password = md5($password);
        if ($_REQUEST['autologin']) {
            setcookie('hash_pass_troll', $password, time() + 365 * 24 * 3600, '/');
            setcookie('num_troll', $_REQUEST['numTroll'], time() + 365 * 24 * 3600, '/');
        }