sakush100 0 Newbie Poster

Hello everyone. This is a small php code to change password.

<?php session_start();
$oldpwd=$_POST['oldpwd'];
$newpwd=$_POST['newpwd'];
$conf=$_POST['conf'];
$currentid=$_SESSION['email'];

if($newpwd!=$conf)
{
echo"Passwords Do Not Match";
}
else
{
if($oldpwd==NULL || $newpwd==NULL ||$conf==NULL)
{
echo"Any fields cannot be left Blank";
}
else
{
require('../connect.php');
mysql_connect($host,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$qry="SELECT * FROM `personal` WHERE email='$currentid'";
$res=mysql_query($qry) or mysql_error();
$data=mysql_fetch_assoc($res);
$oldpass=$data['pass'];
if($oldpass!=$oldpwd)
{
echo"Your old password do not maches with the information you entered.";
}
else
{
$qry2="UPDATE `personal` SET `pass` = '$newpwd' WHERE `email` = '$currentid'";
mysql_query($qry2);
echo"Password Changed Sucessfully";
}}}
?>

Now look at the images below


A popup confirmation appears when the passwords are correct which asks the user to select user for which we need to change the password. This happens only when the textbox type is password, else it works fine. Please suggest something that this popup confirmation should not appear.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.