-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccept.php
More file actions
37 lines (36 loc) · 1.21 KB
/
accept.php
File metadata and controls
37 lines (36 loc) · 1.21 KB
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
<?php
if (isset ($_POST['f_submit'])) {
$datetime = htmlspecialchars($_POST['n']);
$accept_pl = $_POST['a'];
$email = htmlspecialchars($_POST['e']);
$count_pl = count($accept_pl);
$time = date("H:i");
$H = date('H')-1; #true hour
$true_time = date("Y-m-d {$H}:i");
$h1 = 'Подтверждение оплаты';
include 'template/template4.html';
if ($count_pl > 0) {
include_once 'datebase.php';
$query = $pdo->prepare("SELECT free, engaged FROM `ev_hall` WHERE datetime=?");
$query->bindParam(1, $datetime, PDO::PARAM_STR);
$query->execute();
$info_hall = $query->fetch(); #get information about place
$free = explode('/',$info_hall[0]);
$engaged = $info_hall[1];
if (empty($engaged)) {
$engaged = array();
} else {
$engaged = explode('/',$info_hall[1]);
}
foreach ($accept_pl as $value) {
$key = array_search($value-0.1, $engaged);
$engaged[$key] += 0.1;
}
$engaged = implode('/',$engaged);
$request = $pdo->prepare("UPDATE ev_hall SET engaged=? WHERE datetime=?;");
$request->bindParam(1, $engaged, PDO::PARAM_STR);
$request->bindParam(2, $datetime, PDO::PARAM_STR);
$request->execute();
}
include 'template/template5.html';
}