How can we encrypt the username and password using PHP?
Answer Posted / archik123
I am trying to verify the authentication of user login ..
login page is :
<form id="form10" method="post" action="confolog.php">
<fieldset><legend> Personal Information </legend>
User Name : <input type="text" size="15" maxlength ="15" name="Fname"/>
Password: <input type="password" size="15" maxlength="15" name="pwd"/>
<br/>
<input type="submit" value="Submit" name="slog"/>
<input type="reset" value="Reset" name="res"/>
<br/>
( username and password gets stored in a .txt file)
.txt file would look like :
4b83c256a7ee37fef090378006304e15||8a7d7ba288ca0f0ea1ecf975b026e8e1
88e52ee42fd090896f69d0d71e339d94||d6118c0081ba0ecf1a4f9338d0b21cda
and verification page is
$Fname=$_POST['Fname'];
$pwd=$_POST['pwd'];
$encrypted_myname= md5($Fname);
$encrypted_mypassword= md5($pwd);
//echo "encrypting " . $encrypted_myname;
//echo "encrypting " . $encrypted_mypassword;
if (isset($_POST['slog'])){
if($Fname == $encrypted_myname && $pwd == $encrypted_mypassword) {
echo "welcome back , " . $Fname;
}
else {
include ('reglog.php');
echo "username and password do not match ";
}
}
else{
include ('reglog.php');
echo "enter your username";
}
i am not able to verify the user authentication ..so where am i going wrong..please do let me know..
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
How to generate a form?
What are the features of php 7?
How to include a file code in different files in php?
What is default session time in php?
Declare a new variable in php equal to the number 3;
What is the use of "enctype" attribute in a html form?
What exactly is validating and sanitizing?
What is static variable in php?
What are some of the advanced features of php?
Are sessions stateless?
How can I prevent sql-injection in php?
What is xss and csrf?
Steps for the payment gateway processing?
Where are the persistent cookies stored on your computer?
How do you debug php?