-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFromDisToDis.php
219 lines (189 loc) · 7.46 KB
/
FromDisToDis.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<?php
session_start();
if(!isset($_SESSION['mail']))
{
header('frontpage.php');
}
?>
<?php
if (isset($_POST['submit'])) {
if(isset($_POST) & !empty($_POST)){
$_SESSION['travlercount'] = $_POST['travlercount'];
$_SESSION['fromdis'] = $_POST['fromdis'];
$_SESSION['todis'] = $_POST['todis'];
$_SESSION['reason'] = $_POST['reason'];
$_SESSION['vnum'] = $_POST['vnum'];
if($_POST['cars'] == "BIKE" && $_POST['travlercount'] >2)
{
//echo "\n <font face='cambria'> More than 2 members are not allowed, Please change!";
echo "<font face='cambria'> <div style='background-color:red;text-align:center;padding:10px;'>
<h4 style='color:white'>More than 2 members are not allowed for BIKE, Please change!</h4>
</div>";
}
else if($_POST['cars'] == "CAR" && $_POST['travlercount'] >4)
{
echo "<font face='cambria'><div style='background-color:red;text-align:center;padding:10px;'>
<h4 style='color:white'>More than 4 members are not allowed, Please change!</h4>
</div> ";
//echo "\n <font face='cambria'> More than 4 members are not allowed, Please change!";
}
else if($_POST['cars'] == "VAN" && $_POST['travlercount'] >8)
{
echo "<font face='cambria'><div style='background-color:red;text-align:center;padding:10px;'>
<h4 style='color:white'>More than 8 members are not allowed, Please change!</h4>
</div>";
//echo "\n <font face='cambria'> More than 8 members are not allowed, Please change!";
}
else if($_POST['travlercount']=="")
{
echo "<font face='cambria'> <div style='background-color:red;text-align:center;padding:10px;'>
<h4 style='color:white'>Enter Passenger Count</h4>
</div>";
//echo "\n <font face='cambria'> Enter Passenger Count";
}
else if($_POST['fromdis']==$_SESSION['todis'])
{
echo "<font face='cambria'> <div style='background-color:red;text-align:center;padding:10px;'>
<h4 style='color:white'>From and To District cannot be same, Please Change!</h4>
</div>";
//echo "\n <font face='cambria'> Enter Passenger Count";
}
else if(empty($_POST['reason']))
{
echo "<font face='cambria'> <div style='background-color:red;text-align:center;padding:10px;'>
<h4 style='color:white'>Reason is mandatory</h4>
</div>";
//echo "\n <font face='cambria'> Enter Passenger Count";
}
else
{
echo "<div style='background-color:green;text-align:center;padding:10px;'>
<h4 style='color:white'>Success.....</h4>
</div>";
header ("refresh:0.5;url=PersonDetails.php");
}
}}
?>
<html>
<head>
<title>FromDisToDis</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<style>
.container_decor{
background-color:rgb(46,50,86);
background-image:url('tn.jpg');
background-repeat:no-repeat;
background-size:70px 77px;
background-position:10px 2px;
margin-bottom:3%;
}
.error {color: #FF0000;}
#log{
text-align:center;
color:#000000;
}
#log1{
text-align:center;
color:#ffffff;
font:small-caps bolder 28px arial;
}
form{
width: 100%;
margin: 60px auto;
margin-right: 80px;
margin-left: -10px;
margin-top: 5px;
height:150 px;
padding:50px 0;
padding:50px 0;
display: flex;
flex-wrap:wrap;
justify-content: space-around;
background-color: rgba(255,255,255,0.5);
float:none;
}
p {
position: absolute;
left: 400px;
top: 540px;
color: red;
}
body{
background-image:url("stay-home-stay-safe.jpg");
background-repeat:no-repeat;
background-size:30% 48%;
background-position:430px 160px;
opacity:0.9;
}
</style>
</head>
<body>
<div class="container-fluid container_decor">
<h1 style="font-family: cambria;color: white;height: 6%;margin-left: 45%;margin-top: 1%;";>TN e-Pass</h1>
<h5 style="font-family: arial;color: white; height: 1.5%;text-align: center; "><b>Tamil Nadu e-Pass Application Portal</b></h5>
</div>
<form method = "post" action="FromDisToDis.php">
<div class="col-sm-5">
<div class="panel panel-primary">
<div class="panel-heading text-center">
<h4 id="log1" style="font-family: cambria;">E-PASS</h4>
</div>
<div class="panel-body">
<form action="FromDisToDis.php" opacity:1 >
<label name="mode" style="font-family: cambria;">Travel Mode</label>
    <select name="cars" id="cars" value="<?php echo htmlspecialchars($_POST['cars'] ?? '', ENT_QUOTES); ?>" style="font-family: cambria;">
<option value="BIKE">  Bike</option>
<option value="CAR">  Car</option>
<option value="VAN">  Van</option>
</select>
<label for="number" style="font-family: cambria;">         Travellers</label>
  <input type="number" name="travlercount" value="<?php echo htmlspecialchars($_POST['travlercount'] ?? '', ENT_QUOTES); ?>" size="4">
<br> <br> <label name="LabfromDis" style="font-family: cambria;">From District</label>
<?php
$mysqli = new mysqli('localhost', 'Projectphp', 'php123!@#', 'tnepass');
if($mysqli->connect_error)
die('Connect Error (' . mysqli_connect_errno() . ') '. mysqli_connect_error());
$query = "SELECT * FROM tn_districts";
$result = mysqli_query($mysqli, $query);
?>
  <select name="fromdis" value="<?php echo htmlspecialchars($_POST['fromdis'] ?? '', ENT_QUOTES); ?>" style="font-family: cambria;">
<?php
while ($row = mysqli_fetch_array($result)) {
echo "<font face='cambria'> <option value='" . $row['Dis_Name'] . "'>" . $row['Dis_Name'] . "</option>";
}
?>
</select>
    <label name="LabToDis" style="font-family: cambria;">To District</label>
<?php
$mysqli = new mysqli('localhost', 'Projectphp', 'php123!@#', 'tnepass');
if($mysqli->connect_error)
die('Connect Error (' . mysqli_connect_errno() . ') '. mysqli_connect_error());
$query = "SELECT * FROM tn_districts";
$result = mysqli_query($mysqli, $query);
?>
  <select name="todis" value="<?php echo htmlspecialchars($_POST['todis'] ?? '', ENT_QUOTES); ?>" style="font-family: cambria;">
<?php
while ($row = mysqli_fetch_array($result)) {
echo "<font face='cambria'> <option value='" . $row['Dis_Name'] . "'>" . $row['Dis_Name'] . "</option>";
}
?>
</select>
<br><br>
<label for="vnum" style="font-family: cambria;"> Vehicle Number</label>
<br> <input type="text" name="vnum" value="<?php echo htmlspecialchars($_POST['vnum'] ?? '', ENT_QUOTES); ?>" size="25" style="font-family: cambria;">
<br><br>
<label for="reason" style="font-family: cambria;"> Reason</label>
<br> <input type="text" name="reason" value="<?php echo htmlspecialchars($_POST['reason'] ?? '', ENT_QUOTES); ?>" size="25" style="font-family: cambria;">
<br><br>
<input type = "submit" name = "submit" value = "Submit" onclick = "PersonDetails.php" class="btn btn-success" style="font-family: cambria;">
    <a href="secondpage.php " style="font-family: cambria;">Back</a>
</form>
</div>
</div>
</div>
</form>
</body>