forked from deve-sh/Permit-System
-
Notifications
You must be signed in to change notification settings - Fork 0
/
apply.php
140 lines (126 loc) · 4.01 KB
/
apply.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
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?php
session_start();
require_once('./inc/checker.php');
require_once('./inc/config.php');
?>
<!DOCTYPE html>
<html>
<head>
<title>
<?php
if(isset($config['appname']))
echo "Apply - ".$config['appname'];
else
echo "Apply - Permit System";
?>
</title>
<?php include './inc/styles.html'; ?>
</head>
<body>
<div id='root' class="container-fluid">
<div class="main applicationmain">
<?php include './header.php' ?>
<div class="applypagecontainer">
<div class="applicationpage">
<h2>Apply For Permit</h2>
<br/>
<form class="applicationform" action="" method="POST">
Check Date :<br/><br/>
<input name="datetocheck" class='form-control' type="date" required/>
<br/>
<div class="row">
<div class="col-6">
<button class="proceed btn btn-primary" type="submit">Check</button>
</div>
<div class="col-6">
<a href="./"><button class="cancel btn btn-danger">Home</button></a>
</div>
</div>
</form>
<?php
if($_POST['datetocheck']){
$datetocheck = $db->escape($_POST['datetocheck']);
echo "<div class='applicationfiller'>";
// Checking if a permit is available on the given date.
$checkdate = "SELECT * FROM ".$config['tableprefix']."pdates WHERE pdate = '".$datetocheck."';";
$queried = $db->query($checkdate);
if($db->numrows($queried) > 0){
// If there is an opening for the date.
$dateinfo = $db->fetch($queried);
$checkdate1 = "SELECT * FROM ".$config['tableprefix']."permits WHERE pdate = '".$datetocheck."';";
// Check if there is vacancy on the date.
$queried1 = $db->query($checkdate1);
if($db->numrows($queried1) >= $dateinfo['npermits']){
// If there is no vacancy.
echo "<br><br>No vacancy on this date.";
}
else{
// Render a form to proceed further.
?>
<br/>
<form action="finalizeappl.php" class="furtherdetails" method="POST">
<h4>
Enter Your Details
</h4>
<br/>
Date Entered :
<br/>
<input type="date" readonly="true"name="entereddate" value="<?php echo $datetocheck ?>" required class='form-control'/>
<br/>
<label for='vehiclenumber'>Vehicle Number</label> : <br/>
<input type="text" title="Enter your Vehicle Number" name="vehiclenumber" required class="form-control" />
<br/>
<label for='applicantname'>Name</label> : <br/>
<input title="Enter Your Name" type="text" name="applicantname" required class="form-control">
<br/>
<label for='applicantemail'>Email</label> : <br/>
<input title="Enter Your Email" type="email" requied name="applicantemail" class="form-control">
<br/>
<label for='applicantphone'>Phone</label> :
<br/>
<input title="Enter Your Phone Number" type="number" min="0" class="form-control" name="applicantphone" required/>
<br/>
<button type="submit" class="submitdetails">Apply For Permit</button>
</form>
<?php
}
}
else{
echo "<br><br>No permits on this date available.<br><br/>";
}
echo "</div>";
}
?>
</div>
<div class="procedure">
<br/>
<div align="center">
<h3>The Process</h3>
</div>
<div class="row">
<div class="col-md-4" align="center">
<i class="fas fa-calendar-day fa-3x processicon"></i>
<br/><br/>
Select a date.
</div>
<br/><br/>
<div class="col-md-4" align="center">
<i class="fas fa-table fa-3x processicon"></i>
<br/><br/>
Check availability.
</div>
<br/><br/>
<div class="col-md-4" align="center">
<i class="fas fa-clipboard-check fa-3x processicon"></i>
<br/>
<br/>
Apply for the Permit.
</div>
</div>
<br/>
</div>
</div>
</div>
</div>
</body>
</html>