This repository has been archived by the owner on Jun 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
user_edit.php
86 lines (70 loc) · 2.64 KB
/
user_edit.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
<?php
include 'view/header.php';
session_cek();
$groups = tampil_group();
$id = $_GET['id'];
$user = tampil_user_by($id);
//Error Null
$error = null;
//Menambahkan User
if(isset($_POST['submit'])){
$username = $_POST['username'];
$password = $_POST['password'];
$group = $_POST['group'];
$oldname = $user['username'];
$run = edit_user($username,$password,$group,$id,$oldname);
if($run){
$error = "User diubah";
header('Location: user.php');
}else{
$error = "Tidak dapat menambahkan user";
}
}
?>
<div class="row">
<!--sidenav-->
<?php
include 'view/sidenav.php';
?>
<!--main content-->
<div class="col s12 m8">
<h4 style="margin-bottom: 70px;margin-top:50px;">Ubah Hotspot Users</h4>
<div style="margin:40px;">
<blockquote> <?= $error ?> </blockquote>
</div>
<div class="row">
<form class="col s12" method="POST">
<div class="row">
<div class="input-field col s6">
<input id="username" placeholder="user01" type="text" class="validate" name="username" required value=<?= $user['username']?>>
<label for="username" data-error="wrong" data-success="right">Username</label>
</div>
</div>
<div class="row">
<div class="input-field col s6">
<input id="password" type="password" class="validate" name="password" required value=<?= $user['value']?>>
<label for="password">Password</label>
</div>
</div>
<div class="row">
<div class="input-field col s6">
<select name="group" required>
<option name="group" value="<?=tampil_groupId_by($user['username'])?>" selected> <?=tampil_group_by($user['username'])?> </option>
<?php
while( $group = mysqli_fetch_assoc($groups)){
?>
<option name="group" value=<?= $group['groupname'] ?>><?= $group['groupname'] ?> </option>
<?php
}
?>
</select>
<label>Group</label>
</div>
</div>
<button class="btn waves-effect waves-light" type="submit" name="submit"> Simpan </button>
</form>
</div>
</div>
<?php
include 'view/footer.php';
?>