<?php
require ('../credentials.php');
$con=mysqli_connect(HOST, USERNAME, PASSWORD, DBNAME)or die("cannot connect"); 

// array for JSON response

   
if(isset($_POST['username']))
{
    $username=$_POST['username'];
	 $password=$_POST['password'];
	 $new_password=$_POST['new_password'];
	 
    $sql ="Update admin set password= '".$new_password."' where username = '".$username."' and password ='$password'";   
	
	//echo $sql;

  //$result = mysqli_query($con, $sql) or die("Error in Selecting " . mysqli_error($con));

    if ($con->query($sql) === TRUE) {
    echo "New record created successfully";
} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}

   
}
mysqli_close($con);
?>
