[ Mini Kiebo ]
Server: Windows NT DESKTOP-5B8S0D4 6.2 build 9200 (Windows 8 Professional Edition) i586
Path:
D:
/
xampp182
/
htdocs
/
silppm
/
[
Home
]
File: settingPmb.inc.php
<?php $user_id = ""; $user_fullname = ""; $hp = ""; $user_profile = ""; $buton = "Simpan"; $user_pass = "-"; $user_name = "-"; $hp = "-"; $ktp = "-"; $kota_asal = "-"; $alamat = "-"; $user_profile = "-"; $user_fullname = "-"; if(isset($_GET["deleteID"])) { $sql = "delete from user_login where user_id = ".$_GET["deleteID"]; if (mysqli_query($conn, $sql)) { echo "<script>window.alert('Data Sudah Terhapus');</script>"; } else { echo "Error: " . $sql . "<br>" . mysqli_error($conn); } } if(isset($_GET["editID"])) { $sql = "SELECT * FROM user_login where user_id = ".$_GET["editID"]." order by user_id desc"; $result = mysqli_query($conn, $sql); if(mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_assoc($result)) { $user_id = $row['user_id']; $user_fullname = $row['user_fullname']; $user_profile = $row['user_profile']; $user_name = $row['user_name']; $user_pass = $row['user_pass']; $buton = "Koreksi"; } } } if(isset($_GET["setaktif"])) { $setz = mysqli_query($conn, "update user_login set aktif = 0"); $sql = "update user_login set aktif = 1 where id = ".$_GET["setaktif"]; if (mysqli_query($conn, $sql)) { echo "<script>window.alert('Set Aktif');</script>"; } else { echo "Error: " . $sql . "<br>" . mysqli_error($conn); } } if(isset($_POST["Simpan"]) || isset($_POST["Koreksi"])) { if(isset($_POST["user_profile"])) $user_profile = $_POST["user_profile"]; if(isset($_POST["user_fullname"])) $user_fullname = $_POST["user_fullname"]; if(isset($_POST["user_id"])) $user_id = $_POST["user_id"]; if(isset($_POST["user_name"])) $user_name = $_POST["user_name"]; if(isset($_POST["user_pass"])) $user_pass = $_POST["user_pass"]; $tbField[0] = "user_fullname"; $tbField[1] = "user_profile"; $tbField[2] = "user_name"; $tbField[3] = "user_pass"; $tbIsi[0] = "'".$user_fullname."'"; $tbIsi[1] = "'".$user_profile."'"; $tbIsi[2] = "'".$user_name."'"; $tbIsi[3] = "'".$user_pass."'"; if(isset($_POST["Simpan"])) { $nmField = compile_array($tbField); $isiField = compile_array($tbIsi); $sql = "insert into user_login (".$nmField.") values (".$isiField.")"; $notif = $ssm; } if(isset($_POST["Koreksi"])) { $compileSet = compile_array2($tbField,$tbIsi); $sql = "update user_login set ".$compileSet." where user_id = ".$user_id; $notif = $sum; } if (mysqli_query($conn, $sql)) { echo "<script>window.alert('".$notif."');</script>"; } else { echo "Error: " . $sql . "<br>" . mysqli_error($conn); } } ?> <div class="container-fluid"> <div class="card shadow mb-4"> <div class="card-header py-3"> <h6 class="m-0 font-weight-bold text-primary">Entry Data </h6> </div> <div class="card-body"> <form class="user" action="dashboard.php?settingPmb" accept-charset="utf-8" method="post"> <div class="col m6"> <div class="row"> <div class="input-field col m6 s12"> <table border="0" width="100%" cellspacing="1" cellpadding="1"> <tr> <td width="30%">Nama</td> <td width="70%"> <input value="<?php echo $user_id;?>" name="user_id" type="hidden"> <input value="<?php echo $user_fullname;?>" name="user_fullname" type="text" class="form-control" id="exampleFirstName" placeholder="Username Feeder"> </td> </tr> <tr> <td>Profil</td> <td> <select name="user_profile" class="form-control" id="user_profile"> <option value="DOSEN" <?php if($user_profile == "DOSEN") echo "selected";?>>DOSEN</option> <option value="REVIEWER" <?php if($user_profile == "REVIEWER") echo "selected";?>>REVIEWER</option> <option value="ADMIN" <?php if($user_profile == "ADMIN") echo "selected";?>>ADMIN</option> </select> </td> </tr> <tr> <td>Username</td> <td> <input value="<?php echo $user_name;?>" name="user_name" type="text" class="form-control" id="user_name" placeholder=""> </td> </tr> <tr> <td>Password</td> <td> <input value="<?php echo $user_pass;?>" name="user_pass" type="text" class="form-control" id="user_pass" placeholder=""> </td> </tr> <tr> <td> </td> <td> <div class="form-group row"> <div class="col-sm-3 mb-3 mb-sm-0"> <button name="<?php echo $buton;?>" type="submit" class="btn btn-primary btn-block"><?php echo $buton;?></button> </div> <div class="col-sm-3"> <button name="Cancel" type="submit" class="btn btn-primary btn-block">Cancel</button> </div> </div> </td> </tr> </table> </div> </div> </div> </div> </div> </div> </form> <div class="container-fluid"> <!-- Page Heading --> <!-- DataTales Example --> <div class="card shadow mb-4"> <div class="card-header py-3"> <h6 class="m-0 font-weight-bold text-primary">DataTables</h6> </div> <div class="card-body"> <div class="table-responsive"> <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0"> <thead> <tr> <th>Aksi</th> <th>Nama</th> <th>Profil</th> </tr> </thead> <tfoot> <tr> <th>Aksi</th> <th>Nama</th> <th>Profil</th> </tr> </tfoot> <tbody> <?php $sql = "SELECT * FROM user_login order by user_id desc"; $result = mysqli_query($conn, $sql); if(mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_assoc($result)) { ?> <tr> <td> <a class="btn btn-primary btn-danger" href="dashboard.php?settingPmb&deleteID=<?php echo $row['user_id'];?>"><i class="fas fa-trash"></i></a> <a class="btn btn-primary btn-warning" href="dashboard.php?settingPmb&editID=<?php echo $row['user_id'];?>"><i class="fas fa-edit"></i></a> </td> <td><?php echo $row['user_fullname'];?></td> <td><?php echo $row['user_profile'];?></td> </tr> <?php } } ?> </tbody> </table> </div> </div> </div> </div>