Repository navigation
Expand file tree
/
Copy pathbook.php
More file actions
executable file
·59 lines (53 loc) · 2.25 KB
/
Copy pathbook.php
File metadata and controls
executable file
·59 lines (53 loc) · 2.25 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
session_start();
include('config.php');
include('sessioncheck.php');
include('header.php');
?>
<div class="form-container">
<div class="form-wrapper">
<?php
$uid = $_SESSION['log']['useruid'];
// Check for an existing, unpaid booking
$qry_check = mysqli_query($conn, "SELECT * FROM logtable WHERE useruid='$uid' AND payment<>'Paid' ORDER BY id DESC LIMIT 1");
if (mysqli_num_rows($qry_check) > 0) {
// User has an active, unpaid booking
?>
<h1 class="form-title">Lot Already Booked</h1>
<p class="form-subtitle">You already have an active booking. Please proceed to payment or verify your parking status.</p>
<a href="verify.php" class="button button-primary">Go to Verification</a>
<?php
} else {
// User is free to book a new lot
?>
<h1 class="form-title">Book a Free Slot</h1>
<p class="form-subtitle">Select your car number and a desired parking lot.</p>
<form method="post" action="booklot.php" class="modern-form">
<div class="form-group">
<label for="car">Car Number</label>
<input type="text" id="car" name="car" placeholder="e.g., MH 01 AB 1234" required>
</div>
<div class="form-group">
<label for="lot">Parking Lot</label>
<select id="lot" name="lot" required>
<option value="" disabled selected>Select a free lot</option>
<?php
$qry_lots = mysqli_query($conn, "SELECT * FROM lot WHERE status='Free' OR status='Leaving'");
while ($row = mysqli_fetch_array($qry_lots)) {
echo "<option value='{$row['lotname']}'>Lot {$row['lotname']} ({$row['status']})</option>";
}
?>
</select>
</div>
<div class="form-group">
<button type="submit" class="button button-primary form-button">Book Now</button>
</div>
</form>
<?php
}
?>
</div>
</div>
<?php
include('footer.php');
?>