Exemple #1
0
function verification_reg_data($login, $password1, $password2, $email)
{
    //++
    //Login
    $feedback = login_exist($login);
    if (!$feedback === false) {
        return $feedback;
    }
    if (strlen($login) > LOGIN_MAX_LEN) {
        $feedback = "Very long Login, Please put <=" . LOGIN_MAX_LEN . "letters.";
        return $feedback;
    } elseif (strlen($login) == 0) {
        $feedback = "Login is mising! Please put <=" . LOGIN_MAX_LEN . "letters.";
        return $feedback;
    }
    //Login
    //Password
    if (strlen($password1) > PASSWORD_MAX_LEN) {
        $feedback = "Very long Password! Please put <=" . PASSWORD_MAX_LEN . " letters.";
        return $feedback;
    } elseif (strlen($password1) == 0) {
        $feedback = "Password is mising! Please put <=" . PASSWORD_MAX_LEN . "letters.";
        return $feedback;
    }
    if (!($password1 == $password2)) {
        $feedback = "Passwords do not match! Please retype the password.";
        return $feedback;
    }
    //Password
    //E-mail
    $feedback = email_exist($email);
    if (!$feedback === false) {
        return $feedback;
    }
    if (!preg_match("|^[-0-9a-z_\\.]+@[-0-9a-z_^\\.]+\\.[a-z]{2,6}\$|i", $email)) {
        $feedback = "Incorrect Email!";
        return $feedback;
    }
    //E-mail
}
Exemple #2
0
{
    foreach ($content as $value) {
        if ($value['login'] == $id) {
            return true;
        }
    }
    return false;
}
$is_good = false;
if (!empty($_POST['submit']) && $_POST['submit'] == 'OK') {
    if (!empty($_POST['login']) && !empty($_POST['passwd'])) {
        if (file_exists('../private/passwd')) {
            $content_passwd = file_get_contents('../private/passwd');
            if (!empty($content_passwd)) {
                $old = unserialize($content_passwd);
                if (!login_exist($_POST['login'], $old)) {
                    $is_good = true;
                }
            }
        } else {
            $is_good = true;
        }
    }
    if ($is_good) {
        $login = $_POST['login'];
        $passwd = hash('whirlpool', $_POST['passwd']);
        $table_user = array('login' => $login, 'passwd' => $passwd);
        $old[] = $table_user;
        $content = serialize($old) . "\n";
        if (!file_exists('../private')) {
            mkdir('../private');