
<?php
    include_once "connection.php";
    
if(isset($_GET['phoneNumber'])){
    class nasabah{}

    $namalengkap=$_POST['namaLengkap'];
    $email=$_POST['email'];
    $pin=password_hash($_POST['pin'], PASSWORD_DEFAULT);

    $query=mysqli_query($con,"Update nasabah set namaLengkap='$namalengkap',email='$email',pin='$pin' where phoneNumber='".$_GET['phoneNumber']."'");
    if($query){

        $response=new nasabah();
        $response->sucess=1;
        $response->message="Pendaftaran Berhasil";
        die(json_encode($response));

    }else{

        $response=new nasabah();
        $response->sucess=0;
        $response->message="Error occured";
        die(json_encode($response));
    }

    mysqli_close($con);
}
?>
