Encrypting Password using md5() function

md5(); fungsi untuk membuat sistem Login menjadi lebih aman
contoh :

Syntax

$password="123456";

md5($password);

Use md5(); //Encrypting password sehingga menjadi lebih aman


$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);


Sourcecode by




Tidak ada komentar:

Diberdayakan oleh Blogger.