<?php
$xsDatatemp = file_get_contents('js/xs.dat');
$xsDatatemp = json_decode($xsDatatemp);
$oldxs = $_POST['oldxs'];
$newxs = $_POST['newxs'];
$key = array_search($oldxs, $xsDatatemp);
if ($key !== false) {
$xsDatatemp[$key] = $newxs;
}
$newdata = json_encode($xsDatatemp);
file_put_contents("js/xs.dat", $newdata);
?>