-
Notifications
You must be signed in to change notification settings - Fork 0
/
proses_user.php
56 lines (43 loc) · 1.46 KB
/
proses_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
<?php
include "koneksi.php";
if(isset($_POST['simpan'])){
$user=$_POST["user"];
$password=md5($_POST["password"]);
$nama=$_POST["nama"];
$petugas=$_POST["petugas"];
$alamat=$_POST["alamat"];
$email=$_POST["email"];
$tlp=$_POST["tlp"];
$hak_akses=$_POST["hak_akses"];
$query = "INSERT INTO user VALUES ('','$user','$password','$nama','$petugas','$alamat',
'$email','$tlp','$hak_akses')";
$sql=mysqli_query($connect,$query);
//$error = mysqli_error($connect);
// echo $query;
header("location:admin.php?menu=manage_user");
}
elseif (isset($_GET['del'])){
$query = "DELETE FROM user WHERE id_user='". $_GET['id'] ."'";
$sql = mysqli_query($connect,$query);
header("location:admin.php?menu=manage_user");
}elseif (isset($_POST['edit_user'])) {
$id=$_POST['id_user'];
$user=$_POST["user"];
$password=md5($_POST["password"]);
$nama=$_POST["nama"];
$petugas=$_POST["petugas"];
$alamat=$_POST["alamat"];
$email=$_POST["email"];
$tlp=$_POST["tlp"];
$hak_akses=$_POST["hak_akses"];
$query = "UPDATE user SET username='$user', password='$password',
nama_klien='$nama',nama_petugas='$petugas', alamat='$alamat', email='$email',
no_tlp='$tlp',hak_akses='$hak_akses' WHERE id_user='$id'";
$sql = mysqli_query($connect,$query);
// echo $query;
header("location:admin.php?menu=manage_user");
}
elseif (isset($_POST['reset'])) {
header("location:admin.php?menu=manage_user");
}
?>