-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathextendTimer.php
More file actions
32 lines (29 loc) · 763 Bytes
/
Copy pathextendTimer.php
File metadata and controls
32 lines (29 loc) · 763 Bytes
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
<?php
//CORS Headers
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: *");
//HTTP inputs
$rest_json = file_get_contents("php://input");
$_POST = json_decode($rest_json, true);
$seconds = $_POST['seconds'];
$con = mysqli_connect("localhost", "root", "", "othscmsdb");
$sql = "SELECT * from timer";
$res = mysqli_query($con, $sql);
$time=$seconds;
if(mysqli_num_rows($res)>0){
while($row = mysqli_fetch_assoc($res)){
$time+=$row['timer'];
}
}
$sql =
"UPDATE timer
SET timer = $time
";
$res = mysqli_query($con, $sql);
$sql =
"UPDATE timer
SET paused = 0
";
$res = mysqli_query($con, $sql);
echo "SUCCESS";
?>