-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli-profile.php
More file actions
405 lines (298 loc) · 11.8 KB
/
Copy pathcli-profile.php
File metadata and controls
405 lines (298 loc) · 11.8 KB
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
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
<?php
//get user information
session_start();
include('connection.php');
$userid=$_SESSION['id'];
$query=mysqli_query($conn,"select *from `people` where user_id=$userid");
while($row=mysqli_fetch_array($query))
{
$clientid=$row['idc'];
$fullname=$row['fullname'];
$profile=$row['profile'];
$office=$row['office'];
$position = $row['position'];
$contact = $row['contact_n'];
$lastname = $row['lastname'];
$firstname = $row['firstname'];
$m_initial = $row['m_initial'];
$exten = $row['exten'];
}
$qry=mysqli_query($conn,"select *from `user` where id =$userid");
while($roww = mysqli_fetch_array($qry))
{
$userole = $roww['userole'];
$username =$roww['username'];
$password = $roww['password'];
}
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8">
<title>Profile</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="assets/bootstrap/css/style.css">
<link rel="stylesheet" href="assets/bootstrap/css/nav.css">
<link rel="stylesheet" href="assets/bootstrap/css/dashboard.css">
<link rel="stylesheet" href="assets/bootstrap/css/tab.css">
<link rel="stylesheet" href="assets/bootstrap/css/stockroom.css">
<!-- Boxiocns CDN Link -->
<link href='https://unpkg.com/boxicons@2.0.7/css/boxicons.min.css' rel='stylesheet'>
<link rel="stylesheet/less" type="text/css" href="styles.less" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<style>
input[type="submit"]{
background:#0d47a1;
border:none;
padding:8px 10px;
width:20%;
border-radius:5px;
color:white;
float:right;
}
.form-group button{
background:#0d47a1;
border:none;
padding:8px 10px;
width:20%;
border-radius:5px;
color:white;
margin-right:20%;
}
.picform button{
background:#0d47a1;
border:none;
padding:8px 10px;
width:20%;
border-radius:5px;
color:white;
}
#showdiv{
padding:10px 15px;
background:whitesmoke;
color:grey;
}
#showdiv:hover{
background:#0d47a1;
color:white;
}
#closeprofileinfo{
padding:13px 13px;
border-radius:50%;
background-color: white;
color:grey;
font-size:30px;
border:none;
outline:none;
float:right;
}
#closeprofileinfo:hover{
font-size:40px;
}
input[type="text"]:focus{
box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
background:white;
border:none;
outline:none;
}
input[type="text"]{
border-radius:10px;
border:1px solid #ededed;
color:royalblue;
font-style:italic;
width:100%;
outline:none;
padding:12px 12px;
}
input[type="text"]:hover{
box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
}
.row{
margin-bottom:3%;
}
.col{
}
label{
font-size:13px;
}
#update{
padding:12px 15px;
border-radius:5px;
background:#50C878;
color:white;
margin-top:3%;
border:none;
outline:none;
float:right;
box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
}
#update:hover{
background:black;
color:white;
}
</style>
<body style="background:whitesmoke;">
<!--Insert data information -->
<?php
if(isset($_POST["updateprof"]))
{
$var1 = rand(1111,9999); // generate random number in $var1 variable
$var2 = rand(1111,9999); // generate random number in $var2 variable
$var3 = $var1.$var2; // concatenate $var1 and $var2 in $var3
$var3 = md5($var3); // convert $var3 using md5 function and generate 32 characters hex number
$fnm = $_FILES["imgInp"]["name"]; // get the image name in $fnm variable
$dst = "./admin_images/".$var3.$fnm; // storing image path into the {all_images} folder with 32 characters hex number and file name
$dst_db = "admin_images/".$var3.$fnm; // storing image path into the database with 32 characters hex number and file name
$act = "Updated";
$details = "Profile Picture";
move_uploaded_file($_FILES["imgInp"]["tmp_name"],$dst); // move image into the {all_images} folder with 32 characters hex number and image name
mysqli_query($conn, "insert into `clientlog` (fullname,activity,details, user_id) values ('$_POST[fullname]','$act','$details','$_POST[user_id]')");
mysqli_query($conn,"UPDATE `people` SET `profile` ='$dst_db' WHERE `user_id` = '$_POST[user_id]'");
header('location:cli-profile.php'); // executing insert query
/*if($check)
{
echo '<script type="text/javascript"> alert("Data Inserted Seccessfully!"); </script>';
header('location:cli-profile.php'); // alert message
}
else
{
echo '<script type="text/javascript"> alert("Error Uploading Data!"); </script>'; // when error occur
}
*/
}
?>
<!--Side bar-->
<?php
require_once "xc-sidebar.php";
?>
<section class="home-section">
<div class="container-fluid" style="background-color:whitesmoke;">
<div class="card-shadow">
<!--Card header-->
<div class="row" style="background:whitesmoke;">
<div class="col" id="hideinfo" style="background:whitesmoke;margin-right:20%;margin-left:20%;">
<div class="card-body" style="border-radius:10px;background:whitesmoke;">
<div class="card-header py-3" style="background:white;color:grey;border-top-left-radius:10px;border-top-right-radius:10px;border-top:10px solid #A3A3FF;border-left:1px solid #ededed;border-right:1px solid #ededed;">
<h3>Profile Settings</h3>
</div>
<div class="card-body" style="border-bottom:1px solid #ededed;border-bottom-left-radius:10px;border-bottom-right-radius:10px;border-left:1px solid #ededed;border-left:1px solid #ededed;border-right:1px solid #ededed;">
<div class="card-body">
<!-- preview image here-->
<img id="viewpho" style= "object-fit:cover;border:1px solid grey;border-radius:50%;margin-left:30%;" src="<?php echo $profile;?>" alt="Profile Image" height="300px" width="300px"/><br>
</div>
<div class="form-group">
<br>
<h2 style="color:#A3A3FF;margin-left:38%;"><?php echo $fullname;?></h2>
<span style="margin-left:42%;">@<?php echo $username;?></span>
</div>
<div class="form-group">
<br>
<button id=showdiv style="margin-left:38%;">Edit Profile</button><br>
</div>
</div>
</div>
</div>
<div class="col" id="editprofile" style="background:whitesmoke;display:none;margin-right:20%;margin-left:20%;">
<div class="card-body" style="border-radius:10px;border:1px solid #ededed;">
<div class="card-header py-3" style="background:white;border-top-left-radius:5px;border-top-right-radius:5px;">
<div class="row">
<div class="col">
<h3>User Account</h3>
</div>
<div class="col">
<button type="button" id="closeprofileinfo"><i class='bx bx-x' ></i></button>
</div>
</div>
</div>
<div class="card-body" style="border-radius:5px;margin-left:10%;margin-right:10%;">
<form class="picform" method = "post" enctype="multipart/form-data">
<input type='file' id="imgInp" name="imgInp" style="display:none" />
<!-- preview image here-->
<img id="addpho" style= "object-fit:cover;border:1px solid grey;border-radius:50%;margin-left:25%;" src="<?php echo $profile;?>" alt="Profile Image" height="300px" width="300px"/><br>
<input type="hidden" id="user_id" name="user_id" value="<?php echo $userid;?>">
<input type="hidden" id="fullname" name="fullname" value="<?php echo $fullname;?>"> <br>
<button type="submit" name="updateprof" id="updateprof" style="margin-left:34%;">Update Profile</button>
<div>
</form>
<br>
<form method="post" action = "a-updatecprof.php">
<div class="row">
<div class="col">
<label for="lastname">Lastname</label>
<input type='text' name="lastname" id="lastname" placeholder="Lastname" value="<?php echo $lastname;?>" required/>
</div>
<div class="col">
<label for="firstname">Firstname</label>
<input type='text' name="firstname" id="firstname" placeholder="Firstname" value="<?php echo $firstname;?>" required/>
</div>
<div class="col">
<label for="m_initial">Middle Initial</label>
<input type='text' name="m_initial" id="m_initial" placeholder="Middle Initial" value="<?php echo $m_initial;?>" >
</div>
</div>
<div class="row">
<div class="col">
<label for="office">Office :</label>
<input type='text' name="office" id="office" placeholder="Office" value="<?php echo $office;?>" required/>
</div>
<div class="col">
<label for="position">Position :</label>
<input type='text' name="position" id="position" placeholder="Position" value="<?php echo $position;?>" required/>
</div>
<div class="col">
<label for="contact_n">Contact No. :</label>
<input type='text' name="contact_n" id="contact_n" placeholder="Contact No." value="<?php echo $contact;?>" required/>
</div>
</div>
<div class="row">
<div class="col">
<label for="exten">Degree Extension :</label>
<input type='text' name="exten" id="exten" placeholder="Degree Extension" value="<?php echo $exten;?>">
</div>
<div class="col">
<label for="username">Username :</label>
<input type='text' name="username" id="username" placeholder="Username" value="<?php echo $username;?>" required/>
</div>
<div class="col">
<label for="password">Password :</label>
<input type='text' name="password" id="password" placeholder="Password" value="<?php echo $password;?>" required/>
<input type='hidden' name="userid" id="userid" value="<?php echo $userid;?>">
</div>
</div>
<button type="submit" name="submit" id="submit">Update</button>
</form>
</div>
</div>
</div>
</div><!-- -->
<!-- first card body-->
</div>
</div>
</section>
<!-- script for tabs-->
<script src="assets/js/script.js"></script>
<script src = "assets/bootstrap/js/stockroomphoto.js"></script>
<script>
const targetDiv = document.getElementById("editprofile");
const btn = document.getElementById("showdiv");
var hideinfo = document.getElementById("hideinfo");
btn.onclick = function () {
targetDiv.style.display = "block";
hideinfo.style.display = "none";
};
</script>
<script>
const closeprofile = document.getElementById("editprofile");
const closebtn = document.getElementById("closeprofileinfo");
const showhidden = document.getElementById("hideinfo");
closebtn.onclick = function(){
closeprofile.style.display = "none";
showhidden.style.display = "block";
}
</script>
</body>
</html>