-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin-profile.php
321 lines (295 loc) · 19.1 KB
/
admin-profile.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
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
<?php
include("include/admin-header.php");
?>
<!--MAIN Content-->
<div class="row clearfix">
<div class="col-lg-4 col-md-12">
<div class="card profile-header">
<div class="body">
<?php
$result = mysqli_query($conn,"SELECT * FROM hospital.hospitalstaff where email='$Email';");
if($result)
{
$row=mysqli_fetch_assoc($result);
echo"<div class='profile-image'> <img src='assets/images/sm/". $row['profilename'] ." ' class='rounded-circle' > </div>";
}
?>
<div>
<h4 class="m-b-0"><strong>Mr. <?php echo $row['name']; ?></strong></h4>
<span><?php echo $row['education']; ?> <?php echo $row['specialisation']; ?></span>
</div>
<!--<div class="m-t-15">
<button class="btn btn-primary">Follow</button>
<button class="btn btn-outline-secondary">Message</button>
</div>-->
</div>
</div>
<div class="card">
<div class="header">
<h2>Info</h2>
</div>
<div class="body">
<small class="text-muted">Address: </small>
<p><?php echo $row['address']; ?></p>
<small class="text-muted">Email address: </small>
<p><?php echo $row['email']; ?></p>
<small class="text-muted">Mobile: </small>
<p><?php echo $row['cNumber']; ?></p>
<small class="text-muted">Birth Date: </small>
<p class="m-b-0"><?php echo $row['bdate']; ?></p>
<hr>
<small class="text-muted">Social: </small>
<p><i class="fa fa-twitter m-r-5"></i> <?php echo $row['twitter']; ?></p>
<p><i class="fa fa-facebook m-r-5"></i> <?php echo $row['facebook']; ?></p>
<p><i class="fa fa-instagram m-r-5"></i> <?php echo $row['instagram']; ?></p>
</div>
</div>
</div>
<div class="col-lg-8 col-md-12">
<div class="row clearfix text-center">
<div class="col-lg-3 col-md-6 col-sm-12">
<div class="card">
<div class="body">
<input type="text" class="knob" value="<?php echo $row['experience']; ?>" data-width="70" data-height="70" data-thickness="0.1" data-fgColor="#01b2c6">
<h6>Experience</h6>
<span><?php echo $row['experience']; ?> year's of this month</span>
</div>
</div>
</div>
<div class="col-lg-3 col-md-6 col-sm-12">
<div class="card">
<div class="body">
<input type="text" class="knob" value="<?php echo $row['age']; ?>" data-width="70" data-height="70" data-thickness="0.1" data-fgColor="#2196f3">
<h6>age</h6>
<span><?php echo $row['age']; ?> year's of this month</span>
</div>
</div>
</div>
<div class="col-lg-3 col-md-6 col-sm-12">
<div class="card">
<div class="body">
<input type="text" class="knob" value="<?php echo $row['height']; ?>" data-width="70" data-height="70" data-thickness="0.1" data-fgColor="#f44336">
<h6>height</h6>
<span><?php echo $row['height']; ?> feet<br></span>
</div>
</div>
</div>
<div class="col-lg-3 col-md-6 col-sm-12">
<div class="card">
<div class="body">
<input type="text" class="knob" value="<?php echo $row['weight']; ?>" data-width="70" data-height="70" data-thickness="0.1" data-fgColor="#4caf50">
<h6>weight</h6>
<span><?php echo $row['weight']; ?>kg of this month<br></span>
</div>
</div>
</div>
</div>
<div class="card">
<div class="body">
<ul class="nav nav-tabs-new">
<li class="nav-item"><a class="nav-link active" data-toggle="tab" href="#Basic">Basic</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#Account">Account</a></li>
<!--<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#General">General</a></li>-->
</ul>
</div>
</div>
<div class="tab-content padding-0">
<div class="tab-pane active" id="Basic">
<div class="card">
<div class="body">
<h6>Basic Information</h6>
<form action="#" method="post">
<div class="row clearfix">
<div class="col-lg-12 col-md-12">
<div class="form-group">
<input type="text" class="form-control" placeholder="Your Name" name="name">
</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-mortar-board"></i></span>
</div>
<input type="text" class="form-control" placeholder="Specilisation" name="spec">
</div>
</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-institution"></i></span>
</div>
<input type="text" class="form-control" placeholder="Education" name="edu">
</div>
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="Experience in Years" name="exp">
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="Height" name="height">
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="weight" name="weight">
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="Age" name="age">
</div>
<div class="form-group">
<div>
<label class="fancy-radio">
<input name="gen" value="Male" type="radio" checked>
<span><i></i>Male</span>
</label>
<label class="fancy-radio">
<input name="gen" value="Female" type="radio">
<span><i></i>Female</span>
</label>
</div>
</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="icon-calendar"></i></span>
</div>
<input type="date" class="form-control" placeholder="Birthdate" name="date">
</div>
</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-facebook"></i></span>
</div>
<input type="text" class="form-control" placeholder=" Facebook Username" name="face">
</div>
</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-twitter"></i></span>
</div>
<input type="text" class="form-control" placeholder="Twitter Username" name="twit">
</div>
</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-instagram"></i></span>
</div>
<input type="text" class="form-control" placeholder="Instagram Username" name="insta">
</div>
</div>
</div>
<div class="col-lg-12 col-md-12">
<div class="form-group">
<input type="text" class="form-control" placeholder="Full Address" name="addr">
</div>
</div>
</div>
<button type="submit" class="btn btn-primary" name="Update1">Update</button>
</form><br><hr color="gray">
<form action="#" method="post">
<div class="form-group">
<input type="file" name="fileToUpload" id="fileToUpload" placeholder="Profile Photo">
</div>
<button type="submit" class="btn btn-primary" name="Update2">Update</button>
</form>
</div>
</div>
</div>
<div class="tab-pane" id="Account">
<div class="card">
<div class="body">
<h6>Account Security</h6>
<form action="#" method="post">
<div class="row clearfix">
<div class="col-lg-12 col-md-12">
<div class="form-group">
<input type="text" class="form-control" value="<?php echo $row['name']; ?>" disabled placeholder="Username" name="user">
</div>
<div class="form-group">
<input type="email" class="form-control" value="<?php echo $row['email']; ?>" disabled placeholder="Email" name="email">
</div>
<div class="form-group">
<input type="text" class="form-control" disabled placeholder="Phone Number" name="phno" value="<?php echo $row['cNumber']; ?>" >
</div>
</div>
<div class="col-lg-12 col-md-12">
<h6>Change Password</h6>
<div class="form-group">
<input type="password" class="form-control" placeholder="New Password" name="newpass">
</div>
<div class="form-group">
<input type="password" class="form-control" placeholder="Confirm New Password" name="renewpass">
</div>
</div>
</div>
<button type="submit" class="btn btn-primary" name="Update3">Update</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
include("include/admin-footer.php");
if(isset($_POST['Update1']))
{
if(isset($_POST["name"])&& isset($_POST["age"]) && isset($_POST["spec"]) && isset($_POST["edu"]) && isset($_POST["exp"]) && isset($_POST["height"]) && isset($_POST["weight"]) && isset($_POST["gen"]) && isset($_POST["date"]) && isset($_POST["face"]) && isset($_POST["twit"]) && isset($_POST["insta"]) && isset($_POST["addr"]))
{
$Name=$_POST["name"];
$Spec=$_POST["spec"];
$Edu=$_POST["edu"];
$Exp=$_POST["exp"];
$Age=$_POST["age"];
$Height=$_POST["height"];
$weight=$_POST["weight"];
$Gen=$_POST["gen"];
$Date=$_POST["date"];
$Face=$_POST["face"];
$Twit=$_POST["twit"];
$Insta=$_POST["insta"];
$Addr=$_POST["addr"];
$sql= "UPDATE `hospital`.`hospitalstaff` SET `name` = '$Name',`education` = '$Edu', `specialisation` = '$Spec', `experience` = '$Exp', `bdate` = '$Date', `height` = '$Height', `weight` = '$weight', `sex` = '$Gen', `age` = ' $Age', `address` = '$Addr', `facebook` = '$Face', `twitter` = '$Twit', `instagram` = '$Insta', `profilename` = 'avatar1.jpg' WHERE (`email` = '$Email');";
$insert = mysqli_query($conn,$sql);
if($insert)
{
echo"<script>window.alert('Successfully');</script>";
}else echo"<script>window.alert('Please Retry');</script>";
}else echo"<script>window.alert('Please Fill Information Properly');</script>";
}
if(isset($_POST['Update2']))
{
$target_file = basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
// Check if image file is a actual image or fake image
// Check if file already exists
if (file_exists($target_file)) {
echo"<script>window.alert('Sorry, file already exists. Please change your file name and Try again!!');</script>";
$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
echo"<script>window.alert('Sorry, your file was not uploaded');</script>";
// if everything is ok, try to upload file
} else {
move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file);
echo"<script>window.alert('File Uploaded Successfully');</script>";
}
}
if(isset($_POST['Update3']))
{
if(isset($_POST['newpass']) && isset($_POST['renewpass']))
{
$newpass=$_POST['newpass'];$renewpass=$_POST['renewpass'];
if ($newpass==$renewpass)
{
$sql= "UPDATE `hospital`.`hospitalstaff` SET `password` = '$newpass' WHERE (`email` = '$Email');";
$insert = mysqli_query($conn,$sql);
if($insert)
{
echo"<script>window.alert('Successfully Updated');</script>";
}else echo"<script>window.alert('Please Retry');</script>";
}else echo"<script>window.alert('Password And Repassword Should be same');</script>";
}else echo"<script>window.alert('Fill information prioperly');</script>";
}
?>