Repository navigation
Expand file tree
/
Copy pathfee.php
More file actions
executable file
·71 lines (65 loc) · 2.16 KB
/
Copy pathfee.php
File metadata and controls
executable file
·71 lines (65 loc) · 2.16 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
60
61
62
63
64
65
66
67
68
69
70
71
<?php
session_start();
include('config.php');
include('sessioncheck.php');
include('header.php');
$uid = $_SESSION['log']['useruid'];
$qry = mysqli_query($conn, "SELECT * FROM logtable WHERE useruid='$uid' ORDER BY id DESC");
$qry1 = mysqli_num_rows($qry);
$fee_data = null;
$message = '';
$is_fee_payable = false;
if ($qry1) {
$row = mysqli_fetch_array($qry);
if ($row['status'] == 'Left' && $row['payment'] == '') {
$from = $row['fromtime'];
$to = $row['totime'];
$id = $row['id'];
$t1 = StrToTime($from);
$t2 = StrToTime($to);
$diff = $t2 - $t1;
$hours = $diff / (60 * 60);
$fee = 60 * $hours;
$fee = round($fee, 0, PHP_ROUND_HALF_UP);
$fee_data = $fee;
$is_fee_payable = true;
}
else {
$message = "Car Still Parked! (Enter OTP2)";
}
}
else {
$message = "Car Still Parked! (Enter OTP2)";
}
?>
<div class="form-container">
<div class="form-wrapper">
<?php if ($is_fee_payable): ?>
<h1 class="form-title">Fee Generated</h1>
<p class="form-subtitle">Please pay the parking fee to exit.</p>
<form class="modern-form" method="post" action="payment.php">
<div class="form-group">
<label for="fee">Amount (INR)</label>
<input type="text" id="fee" name="fee" value="<?php echo $fee_data; ?>" readonly
style="background-color: #f0f0f0; cursor: not-allowed;" />
</div>
<input type="hidden" name="id" value="<?php echo $id; ?>">
<div class="form-group">
<button class="button button-primary form-button">Pay Now</button>
</div>
</form>
<?php
else: ?>
<h1 class="form-title">Status</h1>
<div class="error-banner" style="margin-top: 20px;">
<?php echo $message; ?>
</div>
<p class="form-subtitle">If you are trying to exit, ensure you have checked out properly.</p>
<div class="form-group">
<a href="dashboard.php" class="button form-button">Back to Dashboard</a>
</div>
<?php
endif; ?>
</div>
</div>
<?php include('footer.php'); ?>