<?php
//setting header to json 
    header('Content-Type: application/json');
    header("Access-Control-Allow-Origin: *");

    $u = $_POST["u"];  // get internal sensor id from js
    $p = $_POST["p"];  // get internal sensor id from js
    require '../php/database.php';

    $password = password_hash($p, PASSWORD_DEFAULT);
    
    // $sql = "UPDATE ds18b20 SET `name`='$name' WHERE `address`='$id'";
    $sql = "UPDATE users SET `username`='$u', `password`='$password' WHERE `userID`='1'";
    
    // $2y$10$prs2O2elGMJHCEIAgOCs.uvMJ9UObZc/HHtw/TJJ0/q59zbZOGy2C

    if ($mysqli->query($sql) === TRUE) {
        // echo "Widget Visible updated successfully";
    } else {
        // echo "Error updating Widget Visible: " . $mysqli->error;
    }


    $mysqli->close();
?>