-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathprofile.php
152 lines (142 loc) · 6.15 KB
/
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
<?php
require 'connection.php';
checkLogin();
$jabatan = mysqli_query($conn, "SELECT * FROM jabatan");
if (isset($_POST['btnEditProfile'])) {
if (editUser($_POST) > 0) {
setAlert("Your Profile has been changed", "Successfully changed", "success");
header("Location: profile.php");
}
}
if (isset($_POST['btnChangePassword'])) {
if (changePassword($_POST) > 0) {
setAlert("Your Password has been changed", "Successfully changed", "success");
header("Location: profile.php");
}
}
?>
<!DOCTYPE html>
<html>
<head>
<?php include 'include/css.php'; ?>
<title>Profile</title>
</head>
<body class="hold-transition sidebar-mini layout-fixed">
<div class="wrapper">
<?php include 'include/navbar.php'; ?>
<?php include 'include/sidebar.php'; ?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm">
<h1 class="m-0 text-dark">Profile</h1>
</div><!-- /.col -->
</div><!-- /.row -->
</div><!-- /.container-fluid -->
</div>
<!-- /.content-header -->
<!-- Main content -->
<section class="content">
<div class="container-fluid">
<div class="card">
<ul class="list-group list-group-flush">
<li class="list-group-item">Nama Lengkap: <?= $dataUser['nama_lengkap']; ?></li>
<li class="list-group-item">Username: <?= $dataUser['username']; ?></li>
<li class="list-group-item">Jabatan: <?= $dataUser['nama_jabatan']; ?></li>
</ul>
</div>
<!-- Button trigger modal -->
<button type="button" class="btn btn-success" data-toggle="modal" data-target="#editProfileModal">
<i class="fas fa-fw fa-edit"></i> Edit
</button>
<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#changePasswordModal">
<i class="fas fa-fw fa-lock"></i> Change Password
</button>
<!-- Modal -->
<div class="modal fade" id="editProfileModal" tabindex="-1" role="dialog" aria-labelledby="editProfileModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<form method="post">
<input type="hidden" name="id_user" value="<?= $dataUser['id_user']; ?>">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="editProfileModalLabel">Edit Profile</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="form-group">
<label for="nama_lengkap">Nama Lengkap</label>
<input type="text" name="nama_lengkap" id="nama_lengkap" class="form-control" required value="<?= $dataUser['nama_lengkap']; ?>">
</div>
<div class="form-group">
<label for="username">Username</label>
<input type="hidden" name="username" id="username" value="<?= $dataUser['username']; ?>">
<input style="cursor: not-allowed;" disabled type="text" name="username" id="username" class="form-control" required value="<?= $dataUser['username']; ?>">
</div>
<div class="form-group">
<label for="id_jabatan">Jabatan</label>
<input type="hidden" name="id_jabatan" id="id_jabatan" value="<?= $dataUser['id_jabatan']; ?>">
<input style="cursor: not-allowed;" disabled type="text" class="form-control" required value="<?= $dataUser['nama_jabatan']; ?>">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal"><i class="fas fa-fw fa-times"></i> Close</button>
<button type="submit" name="btnEditProfile" class="btn btn-primary"><i class="fas fa-fw fa-save"></i> Save</button>
</div>
</div>
</form>
</div>
</div>
<!-- Modal change password -->
<div class="modal fade" id="changePasswordModal" tabindex="-1" role="dialog" aria-labelledby="changePasswordModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<form method="post">
<input type="hidden" name="id_user" value="<?= $dataUser['id_user']; ?>">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="changePasswordModalLabel">Change Password</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="form-group">
<label for="old_password">Old Password</label>
<input type="password" minlength="6" name="old_password" id="old_password" class="form-control" required>
</div>
<div class="form-group">
<label for="new_password">Password</label>
<input type="password" minlength="6" name="new_password" id="new_password" class="form-control" required>
</div>
<div class="form-group">
<label for="new_password_verify">Password Verify</label>
<input type="password" minlength="6" name="new_password_verify" id="new_password_verify" class="form-control" required>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal"><i class="fas fa-fw fa-times"></i> Close</button>
<button type="submit" name="btnChangePassword" class="btn btn-primary"><i class="fas fa-fw fa-save"></i> Save</button>
</div>
</div>
</form>
</div>
</div>
</div>
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<footer class="main-footer">
<strong>Copyright © 2020 By Andri Firman Saputra.</strong>
All rights reserved.
<div class="float-right d-none d-sm-inline-block">
<b>Version</b> 1.0.0
</div>
</footer>
</div>
</body>
</html>