How can we encrypt the username and password using PHP?

Answers were Sorted based on User's Feedback



How can we encrypt the username and password using PHP?..

Answer / 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"/> &nbsp;&nbsp;

Password: <input type="password" size="15" maxlength="15" name="pwd"/> &nbsp; &nbsp;

<br/>




&nbsp; <input type="submit" value="Submit" name="slog"/>

&nbsp; &nbsp;

<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

How can we encrypt the username and password using PHP?..

Answer / don

by using cnc machine

Is This Answer Correct ?    3 Yes 6 No

How can we encrypt the username and password using PHP?..

Answer / naresh

AES.md5($username);
AES.shal($password);

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More PHP Interview Questions

What are the design patterns in php?

0 Answers  


How many Types of COmments are there in PHP and what are they?

4 Answers  


1.<?php echo'bsfjbsnmfbs'; ?> 2.<? ech'hjndfjkshf'; ?> 3 <? echo'naskfdjnask'; three programs are exected but which is beter why

3 Answers   HCL,


What is form submission?

0 Answers  


How to convert a string to lowercase in php?

0 Answers  


What is inheritance in php progaming?

1 Answers  


Why php is sometimes called as embedded scripting language?

0 Answers  


How can we extract string 'abc.com' from a string "http://info@abc.com" using regular expression of PHP

6 Answers   Wipro,


Explain me what is the difference between explode() and split() functions?

0 Answers  


Why do we use sessions in php?

0 Answers  


Is php still used?

0 Answers  


What is the difference between pop3 IMAP and MAPI?

0 Answers  


Categories