<?php
session_start();
header('Access-Control-Allow-Origin:*');
header('Content-Type; application/json; charset=utf-8');
header('Access-control-Allow-Method: POST');
header('Access-control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-request-With');
include('db.php');
    $inputdata = json_decode(file_get_contents("php://input"), true);
    
    $password = $inputdata['password'];
    $id = $inputdata['id'];
    
        //modifier avec le nouveau
        $mod=$db->prepare('UPDATE tbl_user SET password=? WHERE userid=?');
        $res_mod=$mod->execute(array($password, $id));
        if ($res_mod) {
            # 'response' => 1 ; mdp changé
            echo(json_encode(['response' => 1]));
        }else {
            # 'response' => 0 ; erreur changement mdp
            echo(json_encode(['response' => 0]));
        }