mysql - Simple login form in php md5? -
I created a simple login form using php / mysql and I'm using MD5 to store passwords
1 As a password for registration and password
In the registration form
c4ca4238a0b923820dcc509a6f75849b
In the login form when entering the same password
& lt ;? Php is required ('connect.php'); Function signin () {echo "beginning of session"; Session_start (); // Start the session for user profile page $ myuser = mysql_real_escape_string (strip_tags ($ _ POST ['user name']); $ mypass = mysql_real_escape_string (md5 ($ _ POST ['pass'])); echo "& lt ; Br / & gt; "; Echo $ myuser; echo"
; echo $ mypass; $ Query = mysql_query ("user WHERE user name = '$ myuser'" by selecting ") or die (Mysql_error ()); echo $ query; echo "
"; echo "after query"; echo "
if results $ myusername and $ mypassword , Then table row 1 line $ line = mysql_fetch_array ($ query, MYSQL_BOTH) or die Echo (line mysql_error); $ line echo [0]; echo "
"; echo $ line [1]; echo "
; echo per line [2]
"; echo"
"$ ebb";
"$ count = mysql_num_rows ($ query); echo $ count; / * If ($ count == 1) {$ _SESSION ['login_user'] = $ myuser; header ("location: welcome.php"); resonance "successfully login to user profile page ..."; } Else {echo "Sorry ... you enter the wrong ID and password ... please try again ..."; } * /} If (isset ($ _ POST ['submit']) {sign in (); }? & Gt;
But the MD5 yield varies
da39a3ee5e6b4b0d3255bfef95601890afd8070
The approach given to my problem
print $ _POST ['Pass'] directly
Do not use MD5 for password related.
PS Now my code is thank you for everyone.
It is not just possible, try
$ _POST resonance ['near'];
Before MD5 to assume that the value is the same, you may be getting the wrong string
Comments
Post a Comment