PHP Forum

please help me... my password gets encrypted but not able to get in database

hai guys,
please help me... in the following function my password gets encrypted but not able to get in database.is any error in the query please help me......
Advertisement

<?php

$email = $_POST['username'];
$oldpass=$_POST['password'];
Advertisement
$newpass=$_POST['newpass'];
$conpass=$_POST['confirmpass'];

$encry_oldpass=md5($oldpass); //encrypting old password

Advertisement
$con = mysql_connect("localhost","root","");
mysql_select_db("content_management",$con);

$result=mysql_query("SELECT * FROM register_data WHERE eMail='".$email."' and password='".$encry_oldpass."' and isValidate=0 and isDelete=0");
$count=mysql_num_rows($result);

if((!empty($newpass)&&!empty($conpass))&&($newpass==$conpass)&&($count=='0'))
{
$encry_conpass=md5($conpass);//encrypting confirm password

$result2=mysql_query("UPDATE register_data SET password='$encry_conpass' WHERE eMail='".$email."' and password='".$encry_oldpass."' and isValidate=0 and isDelete=0");

echo "Password Chamged Successfully";
header("location:..............."); // redirect to login page

}

else
{
echo"Password Change Fails";
// header("location:..............."); // redirect to password change page
}
?>
Advertisement

0 answers

No answers posted yet. Be the first to answer.

Your answer

Login to answer

Trending today: see what people are reading