S
S
supercoder6662020-05-27 17:09:01
PHP
supercoder666, 2020-05-27 17:09:01

PHP login script not working?

For some reason, the login.php script does not work. Shows no errors, nothing is output. Although, it is in the script. What could be wrong?

<?php 
    session_start();
    require_once 'connect.php';
    require_once 'config.php';

    if (isset($signInBtn)) 
    {
        $erlog = array();
        $user = R::findOne('users', 'login = ?', array($login));
            if ($user) 
            {
                // логин есть, проверка пароля
                if (sha1($password) == $user->password) 
                {
                    // пароль есть, залогинивание
                    echo "ПАРОЛИ И ЛОГИН ВЕРНЫ";
                } 
                else 
                {
                    $erLog[] = "Пароль введен неверно";
                }
            } 
            else 
            {
                $erLog[] = "Пользователя с таким именем не существует";
            }
            if (!empty($erlog)) {
                $_SESSION['message'] = array_shift($erLog);
            }

    }




 ?>

Oh, and here's the list of variables:
$login = $_POST['login'];
        $email = $_POST['email'];
        $password = $_POST['password'];
        $dpassword = $_POST['dpassword'];
        $regButton = $_POST['doReg'];
        $signInBtn = $_POST['signIn'];

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2020-05-27
@supercoder666

The variable name is case-sensitive.
PHP: Basics
$erlog = array();
$erLog[] = "Пароль введен неверно";
$erLog[] = "Пользователя с таким именем не существует";
if (!empty($erlog)) {
$_SESSION['message'] = array_shift($erLog);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question