-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmyprofile.php
296 lines (257 loc) · 11.2 KB
/
myprofile.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
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
<?php
include("includes/dbconfig.php");
?>
<?php
if(isset($_SESSION['user'])){
$id = $_SESSION['user_id'];
$current_date = date('Y-m-d H:i:s');
$query1 = "SELECT * FROM students WHERE id = :id";
$statement1 = $conn->prepare($query1);
$statement1->bindParam(':id', $id, PDO::PARAM_INT);
$statement1->execute();
$student = $statement1->fetch(PDO::FETCH_ASSOC);
// print_r($student);
if(isset($_POST['fee'])) {
$query = "UPDATE students SET logindate = :current_date WHERE id = :id";
$statement = $conn->prepare($query);
$statement->bindParam(':current_date', $current_date, PDO::PARAM_STR);
$statement->bindParam(':id', $id, PDO::PARAM_INT);
$statement->execute();
$_SESSION['name'] = $student['fullname'];
$_SESSION['email'] = $student['email'];
if($student['mess']=='yes'){
header("Location: messfee.php");
} else {
header("Location: fee.php");
}
exit;
}
$lastPaymentDate = strtotime($student['logindate']);
$currentDate = strtotime(date('Y-m-d H:i:s'));
$oneMonthAgo = strtotime('-30 seconds', $currentDate);
if ($lastPaymentDate <= $oneMonthAgo || empty($student['amount'])) {
// It's been a month since the last payment, set a session variable to show the alert
$showPayFeeButton = true;
} else {
$showPayFeeButton = false;
}
$query1 = "SELECT * FROM news order by id desc";
$statement1 = $conn->prepare($query1);
$statement1->execute();
$statement1->setFetchMode(PDO::FETCH_OBJ);
$newsresult = $statement1->fetchAll();
$_SESSION['name'] = $student['fullname'];
$_SESSION['email'] = $student['email'];
$_SESSION['user'] = "student";
$_SESSION['user_id'] = $id;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Hostel Control Management</title>
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/style.css?v=1">
<link rel="stylesheet" href="assets/css/responsive.css?v=1">
<link rel="icon" type="image/x-icon" href="assets/images/hostel.png">
<link rel="stylesheet" href="assets/css/jquery.mCustomScrollbar.min.css">
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.min.css" media="screen">
<style>
.registration-form {
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.registration-form h2 {
text-align: center;
}
.both {
display:flex;
align-items: center;
justify-content: center;
}
.form-group input, textarea {
width: 100%;
padding: 8px;
box-sizing: border-box;
border: 1px solid #ccc;
border-radius: 4px;
}
.form-group button {
background-color: #000;
color: #fff;
padding: 10px;
border: none;
border-radius: 4px;
cursor: pointer;
width: 100%;
}
.form-group button:hover {
background-color: #fe0000;
}
.book_room {
width:500px;
}
@media (max-width: 1527px) {
.registration-form {
width: 500px;
}
}
@media (max-width: 1300px) {
.registration-form {
width: 400px;
}
}
@media (max-width: 1060px) {
.registration-form {
width: 300px;
}
}
@media (max-width: 700px) {
.registration-form {
width: 500px;
}
.both {
flex-direction: column;
}
}
@media (max-width: 500px) {
#register {
display: block;
width: 100%;
height: 27px;
margin-top: -67px;
margin-left: -61px;
padding-top: 0px;
}
.registration-form {
width: 300px;
}
.book_room {
width:100%;
}
}
</style>
</head>
<body class="main-layout" style="overflow-x: hidden;">
<div class="loader_bg">
<div class="loader">
<img src="assets/images/loading.gif" alt="#" />
</div>
</div>
<?php include("includes/header.php"); ?>
<div class="back_re">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="title" style="display:flex; justify-content: center;">
<h2>My Profile</h2>
<a href="tracking.php" style="padding: 50px" name="track"><img src="assets/images/camera.png" width="50px" ></a>
</div>
</div>
</div>
</div>
</div>
<?php
if(isset($_SESSION['status'])) {
if($_SESSION['status'] == 11){
?>
<label class="alert alert-success" style="width:100%">Fees updated successfully!</label>
<?php
}if($_SESSION['status'] == 22){
?>
<label class="alert alert-warning" style="width:100%">Something went wrong!</label>
<?php
}if($_SESSION['status'] == 33){
?>
<label class="alert alert-warning" style="width:100%">Entry / Exit Successfully!</label>
<?php
}else{
}
$_SESSION['status'] = "";
}
?>
<div class="both">
<div class="col-md-5">
<div class="book_room" id="news" style="margin-bottom: 20px; margin-top: 20px;">
<h1>News & Update</h1>
<marquee id="newsMarquee" class="marque" behavior="scroll" direction="up" scrollamount="5" style="overflow: hidden; height: 330px;">
<?php
if($newsresult){
foreach($newsresult as $row){
?>
<h2><?=$row->title?></h2>
<img src="assets/images/new.gif">
<p><?=$row->description?></p>
<a href="<?=$row->pdf_file?>" target="_blank">Download PDF</a>
<br><br>
<?php
}
}
?>
</marquee>
</div>
</div>
<div class="about">
<div class="container-fluid">
<div class="row">
<div class="col-md-6">
<table class="table">
<tr>
<tr><th>Full name</th><td><?=$student['fullname']?></td></tr>
<tr><th>Phone</th><td><?=$student['phone']?></td></tr>
<tr><th>DOB</th><td><?=$student['dob']?></td></tr>
<tr><th>Gender</th><td><?=$student['gender']?></td></tr>
<tr><th>Caste</th><td><?=$student['caste']?></td></tr>
<tr><th>Percentage</th><td><?=$student['percent']?></td></tr>
<tr><th>Branch</th><td><?=$student['branch']?></td></tr>
<tr><th>Year</th><td><?=$student['year']?></td></tr>
<tr><th>Address</th><td><?=$student['address']?></td></tr>
<tr><th>Email</th><td><?=$student['email']?></td></tr>
<tr><th>Applied Mess</th><td><?=$student['mess']?></td></tr>
<tr><th>Amount</th><td><?=$student['amount']?></td></tr>
</tr>
</table>
<?php if($showPayFeeButton): ?>
<form id="fee" method="post">
<div class="form-group">
<button type="submit" name="fee" id="payFeeButton">Pay fee</button>
</div>
</form>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
<?php include("includes/footer.php"); ?>
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/bootstrap.bundle.min.js"></script>
<script src="assets/js/jquery-3.0.0.min.js"></script>
<script src="assets/js/jquery.mCustomScrollbar.concat.min.js"></script>
<script src="assets/js/custom.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function () {
var newsMarquee = document.getElementById('newsMarquee');
function pauseMarquee() {
newsMarquee.stop();
}
function resumeMarquee() {
newsMarquee.start();
}
document.getElementById('news').addEventListener('mouseover', pauseMarquee);
document.getElementById('news').addEventListener('mouseout', resumeMarquee);
});
document.addEventListener("DOMContentLoaded", function () {
<?php if($showPayFeeButton): ?>
alert("Pay fee for mess");
<?php endif; ?>
});
</script>
</body>
</html>