-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckEnd.php
More file actions
45 lines (37 loc) · 849 Bytes
/
checkEnd.php
File metadata and controls
45 lines (37 loc) · 849 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
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
set_time_limit(0);
function getStatus($bcode){
$db = require __DIR__ . '/db_conn.php';
$query = 'SELECT inprogress FROM scores WHERE barcode = :bar';
$select = $db->prepare($query);
$barcodeIn = ['bar' => $bcode];
if ($select->execute($barcodeIn)) {
$assocArray = $select->fetch(PDO::FETCH_ASSOC);
return $assocArray['inprogress'];
}
else {
return false;
}
//var_dump($row); // Uncomment for Debugging
}
//do {
//sleep(1);
//} while (getStatus($_GET['code'])
//flush();
//ob_flush()
/* while (($status = getStatus($_GET['code'])) !== true) {
echo "Run $i</br>";
sleep(1);
$i++;
}
*/
while (true) {
if (!getStatus($_GET['code'])) {
echo "<script type=\"text/javascript\">parent.endClock('" . $_GET['code'] . "')</script>";
break;
}
sleep(1);
}
//if (empty($_GET['code'])) {
//header('Location:error.php'); }
?>