forked from joepie91/tasks.php
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ajax.php
39 lines (31 loc) · 888 Bytes
/
ajax.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
$LANG=NULL;
require('language.en.php');
$file="storage/shot.json";
$jsonfile = file_get_contents($file);
$json_b = json_decode($jsonfile, true);
$json_a = $json_b["shots"];
$closed=0;
$haveshots = 0;
error_reporting(0);
$user=$_POST['user'];
$item=$_POST['id'];
$shotid=$_POST['id'];
$task=$_POST['task'];
$statuse=$_POST['statuse'];
foreach ($json_a as $item => $shot) {
if ($item == $shotid) {
$found = 1;
$current = file_get_contents($file);
$current = json_decode($current, TRUE);
$json_update["shots"]["$item"] = array("user" => $user, "task"=> $task, "statuse"=>$statuse );
$replaced = array_replace_recursive($current, $json_update);
$replaced = json_encode($replaced);
if(file_put_contents($file, $replaced, LOCK_EX)) {
//
} else {
echo "Houston, we have a problem!";
}
}
}
?>