-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver-complaint.php
270 lines (228 loc) · 10 KB
/
server-complaint.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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
<?php include 'config.php'; ?>
<?php
if (isset($_SESSION['user-login-id']) & isset($_SESSION['user-login-name'])) {
$id = $_SESSION['user-login-id'];
$name = $_SESSION['user-login-name'];
}
?>
<?php
date_default_timezone_set('Asia/Calcutta');
$date = date("d/m/Y");
?>
<!doctype html>
<html lang="en">
<head>
<title>
Hostel Complaints - JUIT
</title>
<link type="text/css" href="css/bootstrap.css" rel="stylesheet">
<link href='http://fonts.googleapis.com/css?family=Alegreya+Sans+SC:400,500italic' rel='stylesheet' type='text/css'>
</head>
<body style="background-color:#70B9B0";>
<div class="container-fluid" >
<div class="row">
<div class="col-md-12">
<div style="background-color:#4F827C;padding:10px 10px 10px 10px;margin-left:-20px;margin-right:-20px;">
<center><h2 style="font-family: 'Alegreya Sans SC', sans-serif;color:white"><b>Jaypee Univerisity Of Information Technology</b><br><b>Complaint Registration Portal</b></h2></center>
<div class="row">
<div class="col-md-8"></div>
<div class="col-md-4">
<form action="" method="post">
<button type="submit" class="btn btn-success" name="logout" style="float:right;">Logout</button>
</form>
<br>
</div>
</div>
</div>
</div>
<div class="container">
<!-- Nav tabs -->
<br><br>
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#home" style="color:grey;" aria-controls="home" role="tab" data-toggle="tab">Cyberoam Password Reset</a></li>
<li role="presentation"><a href="#profile" style="color:grey;" aria-controls="profile" role="tab" data-toggle="tab">Lan Port Complaints</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="home">
<div class="container">
<div class="row"><br><br>
<?php
if (isset($_SESSION['user-login-id']) & isset($_SESSION['user-login-name'])) { ?>
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<form action="" method="post">
<!-- <textarea name="complaint" class="form-control" cols="20" rows="10" placeholder="Enter Your Complaint"></textarea><br> -->
<!-- <input type="text" name="complaint" id="inputComplaint" class="form-control" placeholder="Enter Your Complaint" required="required"> -->
<!-- <input type="text" name="free_time" id="inputFree_time" class="form-control" placeholder="Time You are free at" required="required"><br> -->
<!-- <input type="text" name="phone_no" id="inputPhone_no" class="form-control" placeholder="Phone No." required="required"><br> -->
<!-- <input type="text" name="room_no" id="inputRoom_no" class="form-control" placeholder="Hostel & Room No." required="required"><br> -->
<p><center>Log Complaint for : <b><?php echo $id ?></b></center></p>
<br>
<center><button type="submit" class="btn btn-danger" name="log_complaint_cyberoam">Log Complaint</button></center>
<br><br><hr align="center" bgcolor:"white">
</form>
</div>
<div class="col-md-4"></div>
</div>
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8">
<center><h2 style="font-family: 'Alegreya Sans SC', sans-serif;color:white"><b><u>Complaints History</u></b></h2></center>
<?php
?>
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th><center>Complaint No.</center></th>
<th><center>Complaint</center></th>
<th><center>Status</center></th>
</tr>
</thead>
<tbody>
<?php
$select = "SELECT * FROM `server-complaints` WHERE user_id = '$id' order by complaint_id desc";
$result = mysql_query($select);
while ($res = mysql_fetch_assoc($result)) { ?>
<tr>
<td><center><?php echo $res['complaint_id'] ?></center></td>
<td><center><?php echo $res['complaint'] ?></center></td>
<td><center><?php echo $res['status'] ?></center></td>
</tr>
<?php }
?>
</tbody>
</table>
</div>
</div>
<div class="col-md-2"></div>
</div>
<?php }else{ ?>
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<center><h2>Please <a href="index.php">Login</a> to register a complaint.</h2></center>
</div>
<div class="col-md-4"></div>
</div>
<?php }
?>
<?php
if (isset($_POST['log_complaint_cyberoam'])) {
$complaint = $_POST['complaint'];
$free_time = $_POST['free_time'];
$phone_no = $_POST['phone_no'];
$room_no = $_POST['room_no'];
mysql_query("INSERT INTO `server-complaints`(`complaint_id`,`date`, `user_id`, `name`, `complaint`, `free_time`, `phone_no`, `room_no`, `status`) VALUES ('','$date','$id','$name','Password Reset','','','','Pending')");
$select2 = "select * from `server-complaints` NATURAL JOIN `users` where `user_id` = '$id' order by `complaint_id` desc";
$result2 = mysql_query($select2);
$res2 = mysql_fetch_assoc($result2);
mail($res2['email'],"Complaint registered successfully","This is a system generated email. Please do not reply.\r\n\n\nThis is to confirm that your complaint has been successfully registered. The details of the same are given below\r\n\nComplaint Number:".$res2['complaint_id']."\r\nComplaint:".$res2['complaint']."\r\nDate:".$res2['date']."\r\n\nThank You"." ".$res2['name']." "."for using this service. You can track this status of your complaint by logging in to the complaint portal" ,"From: [email protected]\n");
header("location:server-complaint.php");
}
// header("location:complaint.php")
?>
</div>
</div>
</div>
<div role="tabpanel" class="tab-pane" id="profile">
<div class="container">
<div class="row"><br><br>
<?php
if (isset($_SESSION['user-login-id']) & isset($_SESSION['user-login-name'])) { ?>
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<form action="" method="post">
<textarea name="complaint" class="form-control" cols="20" rows="10" placeholder="Enter Your Complaint"></textarea><br>
<!-- <input type="text" name="complaint" id="inputComplaint" class="form-control" placeholder="Enter Your Complaint" required="required"> -->
<input type="text" name="free_time" id="inputFree_time" class="form-control" placeholder="Time You are free at" required="required"><br>
<input type="text" name="phone_no" id="inputPhone_no" class="form-control" placeholder="Phone No." required="required"><br>
<input type="text" name="room_no" id="inputRoom_no" class="form-control" placeholder="Hostel & Room No." required="required"><br>
<br>
<button type="submit" class="btn btn-primary" name="log_complaint_lan">Log Complaint</button><br><br><br><br>
</form>
</div>
<div class="col-md-4"></div>
</div>
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8">
<?php
?>
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th><center>Complaint No.</center></th>
<th><center>Complaint</center></th>
<th><center>Status</center></th>
</tr>
</thead>
<tbody>
<?php
$select = "SELECT * FROM `server-complaints` WHERE user_id = '$id' order by complaint_id desc";
$result = mysql_query($select);
while ($res = mysql_fetch_assoc($result)) { ?>
<tr>
<td><center><?php echo $res['complaint_id'] ?></center></td>
<td><center><?php echo $res['complaint'] ?></center></td>
<td><center><?php echo $res['status'] ?></center></td>
</tr>
<?php }
?>
</tbody>
</table>
</div>
</div>
<div class="col-md-2"></div>
</div>
<?php }else{ ?>
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<center><h2>Please <a href="index.php">Login</a> to register a complaint.</h2></center>
</div>
<div class="col-md-4"></div>
</div>
<?php }
?>
<?php
if (isset($_POST['log_complaint_lan'])) {
$complaint = $_POST['complaint'];
$free_time = $_POST['free_time'];
$phone_no = $_POST['phone_no'];
$room_no = $_POST['room_no'];
mysql_query("INSERT INTO `server-complaints`(`complaint_id`,`date`, `user_id`, `name`, `complaint`, `free_time`, `phone_no`, `room_no`, `status`) VALUES ('','$date','$id','$name','$complaint','$free_time','$phone_no','$room_no','Pending')");
$select2 = "select * from `server-complaints` NATURAL JOIN `users` where `user_id` = '$id' order by `complaint_id` desc";
$result2 = mysql_query($select2);
$res2 = mysql_fetch_assoc($result2);
mail($res2['email'],"Complaint registered successfully","This is a system generated email. Please do not reply.\r\n\n\nThis is to confirm that your complaint has been successfully registered. The details of the same are given below\r\n\nComplaint Number:".$res2['complaint_id']."\r\nComplaint:".$res2['complaint']."\r\nDate:".$res2['date']."\r\n\nThank You"." ".$res2['name']." "."for using this service. You can track this status of your complaint by logging in to the complaint portal" ,"From: [email protected]\n");
header("location:server-complaint.php");
}
// header("location:complaint.php")
?>
</div>
</div>
</div>
</div>
</div>
<footer class="navbar-static-bottom" style="background-color: #4B4C4D; margin-top: 10px;color: #b2b2b1; padding-top: 20px; padding-bottom: 20px;">
<div class = "col-md-12">
<center>
Developed by Web Team, JUIT-IEEE SB
</center>
</div>
<br>
</footer>
<script src = "http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src = "js/bootstrap.js"></script>
<?php
if (isset($_POST['logout'])) {
session_unset($_SESSION['user-login-id']);
session_unset($_SESSION['user-login-name']);
header("location:index.php");
}
?>