Sample PHP code to store and verify the encrypted password

Sample PHP code to Store and verify the encrypted password
Here Base64-encoded and decode function is used to store and retrieve the password.

Base64 encoded function is commonly used when there is a need to encode binary data that needs to be stored and transferred over media that is designed to deal with textual data. It is commonly used in a number of applications, including email via MIME, and storing complex data in XML.

Base64 decoded function is used to yield the original content (decoded content) from the encoded content.

The Base64-encoded function work process involves

  1. Password change into random letters, numbers and/or characters.
  2. Base64-encoded data takes about 33% more space than the original data.



Sample PHP code for Store and verify the encrypted password

To store the password
$Link = mysql_connect ("localhost","root","") or
die('Databse not connected'.mysql_error());
mysql_select_db ("Test", $Link);
$password=$_REQUEST ['pword'];
$query  ="INSERT INTO Reg_test(username,password,email,phone)
To verify the password

$selquery="select * from Reg_test where username='$username'";
<p style="text-align: left;">while ($row = mysql_fetch_array($result,
if($username!=$row['username'] and $password1!=$row['password'])
<script lang="javascript">
alert("Username Didn't Match Please Verify");
window.location.href="[Redirect URL]";
echo $username=$row['username']."&amp;lt;br/&amp;gt;";
echo $password=$pss."&amp;lt;br/&amp;gt;";
echo $email=$row['email']."&amp;lt;br/&amp;gt;";
echo $Phone=$row['phone']."&amp;lt;br/&amp;gt;";

Sample PHP code for creating forgot password feature in any website


Smart Guy/ PHP Developer

Posted in Php Tagged with: , , ,