Пример #1
0
<?php

/**
 * Created by PhpStorm.
 * User: 201250541
 * Date: 2015-11-23
 * Time: 18:51
 */
include_once "Layouts/Head.php";
include_once "Function.php";
$Error = false;
if (isset($_POST['Nom']) && isset($_POST['password'])) {
    $out = IsExistingUser($_POST['Nom'], $_POST['password']);
    echo $out;
    if ($out === false) {
        $Error = true;
    } else {
        /*if(session_status() == PHP_SESSION_NONE)
                {
                    session_start();
                    session_destroy();
                }
        */
        echo $out;
        $_SESSION['IDUsager'] = $out;
        echo $_SESSION['IDUsager'];
        HEADER("Location: index.php");
        UserLogin($_SESSION['IDUsager']);
    }
}
?>
Пример #2
0
include_once "Function.php";
include_once "Layouts/Head.php";
if (isset($_POST['RmMe'])) {
    if (isset($_POST['RememberMe'])) {
        SetRememberMe($_SESSION['IDUsager'], 1);
        $demain = time() + 60 * 60 * 24;
        setcookie("ID", $_SESSION['IDUsager'], $demain);
    } else {
        SetRememberMe($_SESSION['IDUsager'], 0);
        setcookie("ID", null, -1);
    }
}
$Details = GetUserDetails($_SESSION['IDUsager']);
$Error = "";
if (isset($_POST['password']) && isset($_POST['NouveauPassword']) && isset($_POST['NouveauPasswordConfirm'])) {
    if (IsExistingUser($Details['NomUsager'], $_POST['password'])) {
        if ($_POST['NouveauPassword'] == $_POST['NouveauPasswordConfirm']) {
            if (strlen($_POST['NouveauPassword']) > 3) {
                if (strlen($_POST['NouveauPassword']) < 128) {
                    ChangePwd($_SESSION['IDUsager'], $_POST['NouveauPassword']);
                } else {
                    $Error = "Mot de passe trop long!!!";
                }
            } else {
                $Error = "Mot de passe trop court!!!";
            }
        } else {
            $Error = "Le nouveau mot de passe n'est pas le même que la confirmation!!!";
        }
    } else {
        $Error = "Le mot de passe actuel n'est pas bon!!!";