How can we encrypt the username and password using PHP?

Answer Posted / abhijita

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

Is This Answer Correct ?    13 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Are php short tags acceptable to use?

526


How to redirect a url from http to https in .htaccess?

523


What is framework? How it works? What is advantage?

496


What is the difference between file_get_contents() and file_put_contents() in php?

677


What is framework in php for beginners?

526






How can we display information of a variable and readable by human with php?

570


How do I use isdigit function?

562


Tell me what's the difference between include and require?

550


How does the identity operator === compare two values?

672


What does php do?

533


Why json is used in php?

544


What is x+ mode in fopen() used for?

559


How to genrate report in wordpress cms

1808


where do we use htaccess?

545


What happens if an expected input field was not submitted?

528