Registration using MD5 in PHP

This source code will teach you on how to create simple Registration using MD5 in PHP. The feature of this simple tutorial is to save the data to the database then the password is encrypted using the MD5 function. To have this source code, kindly download the source code below to learn the MD5 function in PHP Programming. If you have a question in this tutorial, leave a comment below. Thank you. Registration Form This simple markup contains all form field to save the data to the database. Take a look the source code below, then try it.
  1. <form class="form-horizontal" method="POST">
  2. <div class="control-group">
  3. <label class="control-label" for="inputEmail">Username</label>
  4. <div class="controls">
  5. <input type="text" id="inputEmail" name="username" placeholder="Username" required>
  6. </div>
  7. </div>
  8. <div class="control-group">
  9. <label class="control-label" for="inputPassword">Password</label>
  10. <div class="controls">
  11. <input type="text" id="inputPassword" name="password" placeholder="Password" required>
  12. </div>
  13. </div>
  14. <div class="control-group">
  15. <div class="controls">
  16. <button type="submit" name="register" class="btn btn-success">Save</button>
  17. </div>
  18. </div>
  19. </form>
This simple PHP source code will help you to save the data to the database using this simple query include the INSERT Statement.
  1. <?php
  2.  
  3. if (isset($_POST['register']))
  4. {
  5. $username = $_POST['username'];
  6. $password = md5($_POST['password']);
  7. mysql_query("insert into user (username,password) values('$username','$password')") or die(mysql_error());
  8. header('location:index.php');
  9. }
  10.  
  11. ?>
Database Name: md5_register

Output

Result

Add new comment