<?php $connect=mysql_connect('localhost','root', '') or die(mysql_error()); mysql_select_db(regist); if(isset($_POST['enter'])){ $logn=$_POST['login']; $password=$_POST['password']; $query=mysql_query("SELECT `password` FROM `reg` WHERE `login` = '$login'"); $user_data=mysql_fetch_array($query); if(empty($_POST["password"])){ echo "Пароль не введен"; } if($user_data === md5($password)) { echo "OK"; $an=true; }else{echo ("Неверный логин или пароль");} } ?> <div class="authorization"> <input type="text" name="login" placeholder="Логин" required/> <input type="password" name="password" placeholder="Пароль" required/> <input type="submit" name="enter" value="Войти" /> </div> 

Update

That's what gives out. bool(false) . As I understand it, I get an empty request? Framed

 $query=mysql_query("SELECT `login` FROM `reg` WHERE `login` = '$login'"); if($user_data === $login) { echo "OK"; $an=true; } 

And everything goes well. And the password does not work.

Closed due to the fact that it was off-topic by Athari , zRrr , Nick Volynkin 11 May '16 at 7:09 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • "The question is caused by a problem that is no longer reproduced or typed . Although similar questions may be relevant on this site, solving this question is unlikely to help future visitors. You can usually avoid similar questions by writing and researching a minimum program to reproduce the problem before publishing the question. " - Athari, zRrr, Nick Volynkin
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • $ user_data ['password'] == md5 ($ password)? - Dolbik
  • I tried, it does not work - Bagul
  • one
    Forget about the mysql_ * functions, use PDO and bind. The author, you have a hole in the form of a sql injection in your request, and yet your customers will trust you with their personal data. - Invision
  • I know that there is a hole. I am writing a site to explore the mechanism itself. - Bagul
  • var_dump ($ user_data); Hike $ user_data - array - Den

1 answer 1

Understood. There were 2 problems. It was sealed up and in bd there was a restriction on characters. Thanks to everyone who tried to help.