Answer the question
In order to leave comments, you need to log in
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);
}
}
?>
$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
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 questionAsk a Question
731 491 924 answers to any question