• Home
  • Posts RSS
  • Comments RSS
  • Edit
Blue Orange Green Pink Purple

Development Space - Tips and Tricks

WEB....DEVELOP.....DESIGN.....TIPS....TRICKS....PHP....JQUERY.....JAVASCRIPT

Encrypting Password using md5() function

Syntax
$password="123456";

md5($password);

Use md5(); to encrypts password to make it more secure

 Overview
Look at these two databases, it's the same person and same info, the first one we don't encrypt his password but the second one we encrypted his password

when you encryte "john856" using this code, you'll see this result
"ad65d5054042fda44ba3fdc97cee80c6" This is not a random result, everytime you encrypt the same password you will get the same result.

$password="john856";
$encrypt_password=md5($password);

echo $encrypt_password; 

 Example - Login

This is an example Login with encrypted password but don't forget to encrypt password and insert into database in sign up process.

// username and password sent from form 

$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];

// encrypt password 
$encrypted_mypassword=md5($mypassword);
$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$encrypted_mypassword'";
$result=mysql_query($sql);

於 Wednesday, May 18, 2011
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

0 意見:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Development Space

  • About
      A Cool General Website Development Tips and Tricks. Check out out cool web development tips and tricks. Our tips range from design and programming
  • Category

    • JQuery (15)
    • MYSQL (2)
    • PHP (3)

    Blog Archive

    • ▼  2011 (22)
      • May (22)
    • ►  2008 (1)
      • April (1)

    Total Pageviews

  • Search






    • Home
    • Posts RSS
    • Comments RSS
    • Edit

    © Copyright Dev Space Tips. All rights reserved.

    Back to Top