<?php

require 'db.php';

$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
if(isset($postdata) && !empty($postdata))
{

$password = mysqli_real_escape_string($con, trim($request->form_value->newpassword));
$username = mysqli_real_escape_string($con, trim($request->username));

$sql = "UPDATE admin set password = '$password' where username = '$username'";
$result = mysqli_query($con,$sql);
if($result)
{
    $rows = array('status'=>true,'message' => 'Password Updated');
    echo json_encode($rows);
}
}

?>
