PHP Login form with HTML form -


I am trying to create a login form. It is my HTML form code

  & Lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; Login & lt; / Title & gt; & Lt; Link rel = "stylesheet" type = "text / css" href = "style.css" /> & Lt; / Head & gt; & Lt; Body & gt; & Lt; Div class = "container login" & gt; & Lt; Form action = "login.php" method = "post" class = "form-signin" id = "login_form" & gt; & Lt; H2 square = "form-signin-title" & gt; User Login & lt; / H2 & gt; & Lt; Input type = "text" name = "username" size = "20" placeholder = "user name" & gt; & Lt; Input type = "password" name = "password" size = "20" placeholder = "password" & gt; & Lt; / Br & gt; & Lt; Input type = "submit" value = "login" class = "btn btn-big btn-primary"> gt; & Lt; A href = "signup.html" & gt; Sign up & lt; / A & gt; & Lt; / Form & gt; & Lt; / Div & gt; & Lt; / Body & gt; & Lt; / Html & gt; & Lt ;? Php}? & Gt;  

And this is my php code

  & lt ?? Php if (isset ($ _ POST) & amp; amp; lower ($ _ POST); {session_start (); // Includes connecting to database ("config.php"); // $ Username = mysql_real_escape_string ($ strips slabs ($ _ POST ['username']); // $ password stored in password variable $ password = mysql_real_escape_string (strips slash (MD5 ($ _ POST ['password']))); $ Match = "SELECT id FROM $ table WHERE user name = ''. $ Username" 'and password' ". $ Password" '; $; $ Qry = mysql_query ($ match); $ Num_rows = mysql_num_rows ($ qry) ; If ($ num_rows & lt; = 0) {echo "echo, there is no username with the specified password username".;; "Retry" echo; go out;} and {$ _SESSION ['user'] = $ _POST ["username"]; header ("location: index.html"); // page}} // and {}?  to redirect the user after login 

Ive did 'm 99 'username and' 1234 'password is entered in the database, but it tells me an error that the user name does not exist. Any ideas?

Have you said that you entered 1234 as a password in the table ??

and

  $ password = mysql_real_escape_string (StripsSlash (MD5 ($ _ POST ['password']));  

If you are using password this means that it is 1234 Not password password variables Would that be the error.

Either enter md5 () or MD5 of 1234 in the table


Comments