I need to encrypt the password and store it in the db. i have added a code "$newpass= md5($pass_word);" in php file. but still its not working
<?php
$hostname = "xxxx";
$username = "xxxx";
$password = "xxxx";
$dbName = "xxxx";
$user_name='';
$pass_word='';
$email='';
$errormsg='';
$subject='';
$message='';
$newpass='';
$conn = mysql_connect($hostname,$username,$password) or die(mysql_error());
mysql_select_db($dbName);
if(isset($_POST["submit"]))
{
$user_name=$_POST['usr'];
$address1=$_POST['addr1'];
$address2=$_POST['addr2'];
$pass_word=$_POST['pswd'];
$newpass= md5($pass_word);
$email=$_POST['email'];
if(empty( $user_name))
{
$errormsg='<br>enter the name S';
}
if(trim($address1)=="")
{
$errormsg="<br>entre the address1 S";
//echo $errormsg;
}
if(trim($address2)=="")
{
$errormsg="<br>entre the address2 S";
//echo $errormsg;
}
if(trim($pass_word)=="")
{
$errormsg="<br>entre the password S";
// echo $errormsg;
}
if(trim($email)=="")
{
$errormsg="<br> enter the email S";
// echo $errormsg;
}
$message="your username is".$user_name."your passwod is".$pass_word;
if(strlen($errormsg)==0)
{
mysql_query("INSERT INTO `xxx` ( `id` , `Name` , `Address1` , `Address2` , `password` , `email` )
VALUES (
'', '$user_name', '$address1', '$address2', '$newpass', '$email'
)")or die(mysql_error()); ;
echo $newpass;
echo "you have successfully registered ";
}
mail($email,$subject,$message);
}
?>
Bu benim php sayfası.