<?php

// array for JSON response
$response = array();
$response["list"] = array();

require_once __DIR__ . '/db_config.php';

if (isset($_POST['emailid']) && isset($_POST['token'])) {
    
    $emailid= $_POST['emailid'];
    $firebase_token= $_POST['token'];
    $con = mysqli_connect(DB_SERVER, DB_USER, DB_PASSWORD,DB_DATABASE) or die(mysql_error());

    $query = "UPDATE signupdetails SET firebase_token='$firebase_token' WHERE emailid='$emailid'";
    $result = mysqli_query($con,$query);

    if ($result) {
        $response["s"] = 1;
    } else {
        $response["s"] = 0;
    }
} else {
    $response["s"] = 2;
}
    echo json_encode($response);

?>