Ejemplo n.º 1
0
 public function testConnectUser()
 {
     $this->assertEquals($_SESSION['auth'], false);
     $this->assertEquals($_SESSION['username'], 'old_user');
     // connect new user !
     connectUser('new_user');
     $this->assertEquals($_SESSION['auth'], true);
     $this->assertEquals($_SESSION['username'], 'new_user');
 }
Ejemplo n.º 2
0
function login($login, $passwd)
{
    if (connectUser($login, $passwd) == 1) {
        if ($_SESSION['utype'] == "admin") {
            echo '<script type="text/javascript">', 'document.location.replace("../View/Accueil.php");', '</script>';
        } else {
            echo '<script type="text/javascript">', 'document.location.replace("../View/espaceEtudiant.php");', '</script>';
        }
    } else {
        echo '<script type="text/javascript">', 'document.location.replace("../Index.php?form=login passe incorrect");', '</script>';
        exit;
    }
}
Ejemplo n.º 3
0
                $choose_another_login = true;
                $save_failed = true;
            }
        } else {
            $save_failed = true;
        }
    }
}
//Connection of a user
if (isset($_POST['connection']) && !USER_IS_CONNECTED) {
    $login = isset($_POST['l_caver_login']) ? $_POST['l_caver_login'] : '';
    $password = isset($_POST['l_caver_password']) ? $_POST['l_caver_password'] : '';
    $key = isset($_POST['l_key']) ? $_POST['l_key'] : '';
    $password = crypt_xor(stripslashes($password), $key);
    $string = isset($_POST['l_caver_check']) ? $_POST['l_caver_check'] : '';
    $connectionArray = connectUser($login, $password, $string);
    $activated = $connectionArray['Activated'];
    $banned = $connectionArray['Banned'];
    $registered = $connectionArray['Registered'];
    $connection_failed = !$connectionArray['Connected'];
    if ($connection_failed) {
        $_SESSION['login_retry'] += 1;
    } else {
        if ($result['status'] != LOGIN_SUCCESS && !defined('NO_PHPBB_INSTALLED')) {
            addphpBBuser($login, $password, $_SESSION['user_contact'], $_SESSION['user_language']);
        }
    }
} else {
    $_SESSION['login_retry'] = 1;
}
//Send a new password to the user :
Ejemplo n.º 4
0
<?php

// if user isn't connected
if (!isConnected()) {
    $loginError = false;
    // if form submitted
    if (isset($_POST["login"]) && isset($_POST["password"])) {
        // check credentials
        if (checkUserPassword($_POST["login"], $_POST["password"])) {
            // connect user and redirect
            connectUser($_POST["login"]);
            redirect('accueil');
        }
        // notice view there is an error in login
        $loginError = true;
    }
    // include view
    include_once 'views/loginForm.php';
} else {
    // user already connected
    redirect('accueil');
}
Ejemplo n.º 5
0
<?php

$liste_categories = getListCategory();
if (isset($_POST['user']) && isset($_POST['password'])) {
    $user = secure($_POST['user']);
    $password = secure($_POST['password']);
    $_SESSION['user'] = connectUser($user, $password);
    $_SESSION['sid'] = session_id();
    if ($_SESSION['user'] == false) {
        $error_form_connection = 'Identifiants invalides !';
    }
}
if (isset($_GET['action'])) {
    $action = secure($_GET['action']);
    $autorized_actions = array('inscription', 'oubli', 'submitinscription');
    if (in_array($action, $autorized_actions)) {
        if (isset($_POST['submitinscription'])) {
            if (isset($_POST['nom']) && isset($_POST['login']) && isset($_POST['pass1']) && isset($_POST['pass2']) && isset($_POST['email'])) {
                $nom = secure($_POST['nom']);
                $login = secure($_POST['login']);
                $pass1 = secure($_POST['pass1']);
                $pass2 = secure($_POST['pass2']);
                $email = secure($_POST['email']);
                if ($pass1 == $pass2) {
                    if (setNewUser($nom, $login, $email, $pass1, 3)) {
                        $iscriptionok = 'Félicitation, vous pouvez dès à présent vous connecter sur votre espace client !';
                    } else {
                        $iscriptionerror = 'Veuillez saisir le même mot de passe deux fois !';
                    }
                } else {
                    $iscriptionerror = 'Veuillez saisir le même mot de passe deux fois !';
Ejemplo n.º 6
0
<?php

session_start();
$_SESSION["servername"] = "192.168.2.30:3307";
$_SESSION["Dusername"] = "******";
$_SESSION["Dpassword"] = "******";
$_SESSION["dbname"] = "adventure";
$_SESSION["username"] = $_POST["username"];
$_SESSION["password"] = $_POST["password"];
include_once 'Functions.php';
NoSessionHeadprint();
$PID = connectUser($_POST["username"], $_POST["password"]);
$_SESSION["PID"] = $PID;
PrintUI($PID);
?>
</body>
</html>