-
Notifications
You must be signed in to change notification settings - Fork 6
/
edit-user.php
496 lines (436 loc) · 15.2 KB
/
edit-user.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
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
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
<?php
session_start();
include 'dbconf.php';
if (!isset($_SESSION['login']))
header('Location: login-ui.php');
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title><?php echo $_SESSION['judul'];?> | <?php echo $_SESSION['desc'];?></title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.6 -->
<link rel="stylesheet" href="lte/bootstrap/css/bootstrap.min.css">
<!-- bootstrap datepicker -->
<link rel="stylesheet" href="lte/plugins/datepicker/datepicker3.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="lte/dist/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="lte/dist/css/ionicons.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="lte/dist/css/AdminLTE.min.css">
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link rel="stylesheet" href="lte/dist/css/skins/_all-skins.min.css">
<!-- jQuery 2.2.0 -->
<script src="lte/plugins/jQuery/jQuery-2.2.0.min.js"></script>
<!-- Add mousewheel plugin (this is optional) -->
<script type="text/javascript" src="assets/jquery.mousewheel.pack.js?v=3.1.3"></script>
<!-- Add fancyBox main JS and CSS files -->
<script type="text/javascript" src="assets/jquery.fancybox.pack.js?v=2.1.5"></script>
<link rel="stylesheet" type="text/css" href="assets/jquery.fancybox.css?v=2.1.5" media="screen" />
<!-- Add Button helper (this is optional) -->
<link rel="stylesheet" type="text/css" href="assets/helpers/jquery.fancybox-buttons.css?v=1.0.5" />
<script type="text/javascript" src="assets/helpers/jquery.fancybox-buttons.js?v=1.0.5"></script>
<!-- Add Thumbnail helper (this is optional) -->
<link rel="stylesheet" type="text/css" href="assets/helpers/jquery.fancybox-thumbs.css?v=1.0.7" />
<script type="text/javascript" src="assets/helpers/jquery.fancybox-thumbs.js?v=1.0.7"></script>
<!-- Add Media helper (this is optional) -->
<script type="text/javascript" src="assets/helpers/jquery.fancybox-media.js?v=1.0.6"></script>
<link rel="icon" href="favicon.ico">
<script type="text/javascript">
$(document).ready(function() {
/*
* Simple image gallery. Uses default settings
*/
$('.fancybox').fancybox();
/*
* Different effects
*/
// Change title type, overlay closing speed
$(".fancybox-effects-a").fancybox({
helpers: {
title : {
type : 'outside'
},
overlay : {
speedOut : 0
}
}
});
// Disable opening and closing animations, change title type
$(".fancybox-effects-b").fancybox({
openEffect : 'none',
closeEffect : 'none',
helpers : {
title : {
type : 'over'
}
}
});
// Set custom style, close if clicked, change title type and overlay color
$(".fancybox-effects-c").fancybox({
wrapCSS : 'fancybox-custom',
closeClick : true,
openEffect : 'none',
helpers : {
title : {
type : 'inside'
},
overlay : {
css : {
'background' : 'rgba(238,238,238,0.85)'
}
}
}
});
// Remove padding, set opening and closing animations, close if clicked and disable overlay
$(".fancybox-effects-d").fancybox({
padding: 0,
openEffect : 'elastic',
openSpeed : 150,
closeEffect : 'elastic',
closeSpeed : 150,
closeClick : true,
helpers : {
overlay : null
}
});
/*
* Button helper. Disable animations, hide close button, change title type and content
*/
$('.fancybox-buttons').fancybox({
openEffect : 'none',
closeEffect : 'none',
prevEffect : 'none',
nextEffect : 'none',
closeBtn : false,
helpers : {
title : {
type : 'inside'
},
buttons : {}
},
afterLoad : function() {
this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
}
});
/*
* Thumbnail helper. Disable animations, hide close button, arrows and slide to next gallery item if clicked
*/
$('.fancybox-thumbs').fancybox({
prevEffect : 'none',
nextEffect : 'none',
closeBtn : false,
arrows : false,
nextClick : true,
helpers : {
thumbs : {
width : 50,
height : 50
}
}
});
/*
* Media helper. Group items, disable animations, hide arrows, enable media and button helpers.
*/
$('.fancybox-media')
.attr('rel', 'media-gallery')
.fancybox({
openEffect : 'none',
closeEffect : 'none',
prevEffect : 'none',
nextEffect : 'none',
arrows : false,
helpers : {
media : {},
buttons : {}
}
});
/*
* Open manually
*/
$("#fancybox-manual-a").click(function() {
$.fancybox.open('1_b.jpg');
});
$("#fancybox-manual-b").click(function() {
$.fancybox.open({
href : 'iframe.html',
type : 'iframe',
padding : 10
});
});
$("#fancybox-manual-c").click(function() {
$.fancybox.open([
{
href : '1_b.jpg',
title : 'My title'
}, {
href : '2_b.jpg',
title : '2nd title'
}, {
href : '3_b.jpg'
}
], {
helpers : {
thumbs : {
width: 75,
height: 50
}
}
});
});
});
</script>
<style type="text/css">
.fancybox-custom .fancybox-skin {
box-shadow: 0 0 50px #222;
}
</style>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="hold-transition fixed skin-green sidebar-mini">
<!-- Site wrapper -->
<div class="wrapper">
<header class="main-header">
<!-- Logo -->
<a href="#" class="logo">
<!-- mini logo for sidebar mini 50x50 pixels -->
<span class="logo-mini"><b><?php echo $_SESSION['judul'];?></b></span>
<!-- logo for regular state and mobile devices -->
<span class="logo-lg"><b><?php echo $_SESSION['judul'];?></b></span>
</a>
<!-- Header Navbar: style can be found in header.less -->
<nav class="navbar navbar-static-top">
<!-- Sidebar toggle button-->
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<!-- User Account: style can be found in dropdown.less -->
<li class="dropdown user user-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<img src="<?php echo $_SESSION['foto'];?>" class="user-image" alt="User Image">
<span class="hidden-xs"><?php echo ucwords($_SESSION['user']);?></span>
</a>
<ul class="dropdown-menu">
<!-- User image -->
<li class="user-header">
<img src="<?php echo $_SESSION['foto'];?>" class="img-circle" alt="User Image">
<p>
<?php
echo ucwords($_SESSION['user']);?> - <?php echo ucwords($_SESSION['level']);
$date = date_create($_SESSION['since']);
?>
<small>Member Since, <?php echo date_format($date, 'd M Y');?></small>
</p>
</li>
<!-- Menu Footer-->
<li class="user-footer">
<div class="pull-left">
<!--a href="#" class="btn btn-default btn-flat">Profile</a-->
</div>
<div class="pull-right">
<a href="logout.php" class="btn btn-default btn-flat">Logout</a>
</div>
</li>
</ul>
</li>
</ul>
</div>
</nav>
</header>
<!-- =============================================== -->
<!-- Left side column. contains the sidebar -->
<aside class="main-sidebar">
<!-- sidebar: style can be found in sidebar.less -->
<section class="sidebar">
<!-- Sidebar user panel -->
<div class="user-panel">
<div class="pull-left image">
<img src="<?php echo $_SESSION['foto'];?>" class="img-circle" alt="User Image">
</div>
<div class="pull-left info">
<p><?php echo ucwords($_SESSION['user']);?></p>
<a href="#"><i class="fa fa-circle text-success"></i> Online</a>
</div>
</div>
<!-- /.search form -->
<!-- sidebar menu: : style can be found in sidebar.less -->
<ul class="sidebar-menu">
<li class="header">MAIN NAVIGATION</li>
<li>
<a href="dashboard-ui.php">
<i class="fa fa-windows"></i> <span>Dashboard</span>
</a>
</li>
<li>
<a href="hasil.php">
<i class="fa fa-laptop"></i> <span>Hasil Perhitungan</span>
</a>
</li>
<?php if($_SESSION['level']=='admin'){?>
<li>
<a href="kriteria.php">
<i class="fa fa-book"></i> <span>Data Kriteria</span>
</a>
</li>
<li>
<a href="karyawan.php">
<i class="fa fa-users"></i> <span>Data Karyawan</span>
</a>
</li>
<li>
<a href="penilaian.php">
<i class="fa fa-list"></i> <span>Data Penilaian</span>
</a>
</li>
<li class="active">
<a href="user.php">
<i class="fa fa-user"></i> <span>Data User</span>
</a>
</li>
<?php } ?>
</ul>
</section>
<!-- /.sidebar -->
</aside>
<!-- =============================================== -->
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1 class="text-success">
Dashboard
<small><?php echo $_SESSION['desc'];?></small>
</h1>
<ol class="breadcrumb">
<li><a href="dashboard-ui.php"><i class="fa fa-dashboard"></i> Dashboard</a></li>
<li><a href="user.php">Data User</a></li>
<li class="active">Edit User</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<!-- Default box -->
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title text-success"><i class="fa fa-user"> </i> Edit User</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse">
<i class="fa fa-minus"></i></button>
<!--button type="button" class="btn btn-box-tool" data-widget="remove" data-toggle="tooltip" title="Remove">
<i class="fa fa-times"></i></button-->
</div>
</div>
<!-- form start -->
<form class="form-horizontal" enctype="multipart/form-data" method="post" action="proses-edit-user.php?id=<?php echo $_GET['id'];?>">
<div class="row">
<div class="col-lg-6 col-xs-12">
<div class="box-body">
<?php
$result = $mysqli->query("SELECT * FROM `user` WHERE `id` = ".$_GET['id']."");
while ($row = $result->fetch_assoc()) {
?>
<div class="form-group">
<label for="user" class="col-sm-2 control-label">Username</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="user" id="user" value="<?php echo $row['user'];?>" placeholder="Username Baru" required />
</div>
</div>
<div class="form-group">
<label for="pass" class="col-sm-2 control-label">Password</label>
<div class="col-sm-10">
<input type="password" class="form-control" name="pass" id="pass" placeholder="Password Baru" required />
</div>
</div>
<div class="form-group">
<label for="nopol" class="col-sm-2 control-label">Level</label>
<div class="col-sm-10">
<select class="form-control" name="level" id="level">
<option value="admin" <?php if($row['level']=='admin') echo "selected";?>>Admin</option>
<option value="karyawan" <?php if($row['level']=='karyawan') echo "selected";?>>Karyawan</option>
</select>
</div>
</div>
<div class="form-group">
<label for="supir" class="col-sm-2 control-label">Since</label>
<div class="col-sm-10">
<input type="text" class="form-control pull-right" id="datepicker" name="since" value="<?php echo date('m/d/Y',strtotime($row['since']));?>" required />
</div>
</div>
<div class="form-group">
<label for="foto" class="col-sm-2 control-label">Foto</label>
<div class="col-sm-10">
<!-- MAX_FILE_SIZE must precede the file input field -->
<input type="hidden" name="MAX_FILE_SIZE" value="10000000" />
<input type="file" name="foto" id="foto" placeholder="Foto" required />
<br>
<a class='fancybox-effects-d' href='uploads/<?php echo $row['foto'];?>' title='<?php echo $row['user'];?>'><img src="uploads/<?php echo $row['foto']; ?>" width=100 height=100 /></a>
</div>
</div>
</div>
<!-- /.box-body -->
<div class="box-footer">
<a type="button" class="btn btn-danger" href="user.php">Cancel</a>
<button type="submit" class="btn btn-success pull-right">Update</button>
</div>
<!-- /.box-footer -->
<?php } ?>
</div>
</div><!-- row -->
</form>
</div>
<!-- /.box -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<footer class="main-footer">
<div class="pull-right hidden-xs">
<b>Version</b> <?php echo $_SESSION['judul'].".".date('Y').".a"?>
</div>
<strong>Copyright © <?php echo date('Y');?></strong> <?php echo $_SESSION['creator']?>. All rights
reserved.
</footer>
<!-- /.control-sidebar -->
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
<div class="control-sidebar-bg"></div>
</div>
<!-- ./wrapper -->
<!-- Bootstrap 3.3.6 -->
<script src="lte/bootstrap/js/bootstrap.min.js"></script>
<!-- bootstrap datepicker -->
<script src="lte/plugins/datepicker/bootstrap-datepicker.js"></script>
<!-- SlimScroll -->
<script src="lte/plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="lte/plugins/fastclick/fastclick.js"></script>
<!-- AdminLTE App -->
<script src="lte/dist/js/app.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="lte/dist/js/demo.js"></script>
<!-- Page script -->
<script>
$(function () {
//Date picker
$('#datepicker').datepicker({
autoclose: true
});
});
</script>
</body>
</html>