-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdateComplete.php
32 lines (28 loc) · 984 Bytes
/
updateComplete.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
<?php
require 'database.php';
require 'generalNotificationFuncs.php';
$bid = $_POST["bid"];
if (!empty($bid)) {
$db = new Database();
$stmt = $db->prepare("SELECT userID from billContributors WHERE billID = :bid");
$stmt->bindValue(":bid", $bid, SQLITE3_INTEGER);
$result = $stmt->execute();
while ($user = $result->fetchArray()) {
$stmt = $db->prepare("INSERT INTO notifications(userID, typeID) VALUES(:uid, :type)");
$stmt->bindValue(":uid", $user[0], SQLITE3_INTEGER);
if ($_POST["compState"] != 0) $type = 11; else $type = 19;
$stmt->bindValue(":type", $type, SQLITE3_INTEGER);
$stmt->execute();
$liid = $db->lastInsertRowID();
notiLumpBill($db, $liid, $bid);
}
$stmt = $db->prepare("UPDATE bills
SET complete = :cs, editTS = datetime('now')
WHERE billID = :bid");
$stmt->bindValue(":bid", $bid, SQLITE3_INTEGER);
$stmt->bindValue(":cs", $_POST["compState"], SQLITE3_INTEGER);
$stmt->execute();
exit();
}
?>
<?php include "wrongTurn.php"; ?>