Beispiel #1
0
<?php

$encrypt = new \App\noctus\encrypt("esetbon", "mosheB55");
$en_user = $encrypt->encrypt();
$decrypt = new \App\noctus\decrypt($en_user, "esetbon", "mosheB55");
$de_user = $decrypt->decrypt();
?>
<h2>Encrypt User</h2>
<pre><?php 
var_dump($en_user);
?>
</pre>

<h2>Decrypt user</h2>
<?php 
if ($de_user == true) {
    echo "<pre>OK</pre>";
} else {
    echo "<pre>Erreur</pre>";
}
?>

Beispiel #2
0
    $_SESSION['account']['away']['prenom_user'] = $user->prenom_user;
    if ($user_u == 1) {
        $fonction->redirect("lockscreen");
    } else {
        $fonction->redirect("error", "", "", "code", "USR2", "");
    }
}
if (isset($_POST['action']) && $_POST['action'] == 'deverrouille') {
    session_start();
    require "../application/classe.php";
    $username = $_POST['username'];
    $password = $_POST['password'];
    $encrypt = new encrypt($username, $password);
    $pass_en = $encrypt->encrypt();
    $decrypt = new \App\noctus\decrypt($pass_en, $username, $password);
    $pass_de = $decrypt->decrypt();
    $user_co = $DB->count("SELECT COUNT(iduser) FROM users WHERE username = :username AND password = :password", array("username" => $username, "password" => $pass_en));
    if ($user_co == 1) {
        $_SESSION['account']['connect'] = 1;
        $_SESSION['account']['away']['username'] = $user->username;
        $user_u = $DB->execute("UPDATE users SET connect = 2, last_connect = :last_connect WHERE username = :username", array("username" => $username, "last_connect" => $date_format->format_strt(date("d-m-Y H:i:s"))));
        if ($user_u == 1) {
            $fonction->redirect("dashboard");
        }
    } elseif ($user_co == 0) {
        $text = "Aucun couple Nom d'utilisateur / Mot de Passe correspondant.";
        $fonction->redirect("lockscreen", "", "", "error", "deverouille", $text);
    } else {
        $fonction->redirect("error", "", "", "code", "USR3", "");
    }
}