Exemple #1
0
 public function testAddDelUser()
 {
     userAddRemove("toto", "tata", true);
     $SHADOW = json_decode(file_get_contents('./data/users.json'), true);
     $newhash = hash("sha256", "totoSalt&Peppertata");
     $this->assertTrue(isset($SHADOW[$newhash]));
     userAddRemove("toto", null, null);
     $SHADOW = json_decode(file_get_contents('./data/users.json'), true);
     $this->assertFalse(isset($SHADOW[$newhash]));
 }
Exemple #2
0
}
//Default language load
if (!isset($_SESSION['LANG'])) {
    $_SESSION['LANG'] = 'french';
}
//Inits the authentification
if (!isset($_SESSION['AUTH'])) {
    $_SESSION['AUTH'] = 0;
}
//Verifies the user/pass combo of the user and grants the access (or not)
if (isset($_POST['inputUser']) && isset($_POST['inputPassword']) && ctype_alnum($_POST['inputUser']) && ctype_alnum($_POST['inputPassword'])) {
    userAuth($_POST['inputUser'], $_POST['inputPassword']);
}
//Adds or modifies the user
if (isset($_POST['modUser']) && ctype_alnum($_POST['modUser'])) {
    userAddRemove($_POST['modUser'], $_POST['modPassword'], isset($_POST['modAdmin']) ? true : false);
}
//Redirects to main page on first arrival
if (isset($_SESSION['AUTH']) && $_SESSION['AUTH'] == 1) {
    if ($_SESSION['PAGE'] == 'signin.php') {
        $_SESSION['PAGENAME'] = 'AM-VS TaskManager';
        $_SESSION['PAGE'] = 'main.php';
    } else {
        //Navigate to other pages
        if (isset($_POST['manage'])) {
            unset($_POST['manage']);
            $_SESSION['PAGENAME'] = 'AM-VS Manager';
            $_SESSION['PAGE'] = 'manage.php';
        } else {
            if (isset($_POST['return'])) {
                unset($_POST['return']);