html - Encrypt Form Data MD5 -


i have following form:

       <form method="post" enctype="application/x-www-form-urlencoded" action="logincheck.php" autocomplete="off" >        <table>        <tr>        <td><label for="username">username</label></td>        <td><input type="text" name="username"></input></td>        </tr>        <tr>        <td><label for="password">password</label></td>        <td><input name="password" type="password"></input></td>        </tr>        <tr>        <td><input type="submit" value="submit"</input></td>        </tr>        </table>        </form> 

and loginsuccess.php has following checks (there more php code relevant part):

$username = mysqli_real_escape_string($connect, $_post['username']); $password = mysqli_real_escape_string($connect, $_post['password']);   $encrypted_mypassword=md5($password);  $query = "select * students username = '".$username."' , password = '".$encrypted_mypassword."'";  $result = $connect->query($query); 

the user should taken page (which works without new:

$encrypted_mypassword=md5($password); 

but instead sent error page , isn't working. ideas?

the problem seems store passwords in plaintext in database. need store hash of passwords instead.

bear in mind md5 is, these days, not appropriate algorithm use password hashing, if used unsalted. fast, , can brute-force searched relatively easily. use password_hash() instead.


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -