| Direktori : /var/www/vhosts/ccp.ac.th/smtp.ccp.ac.th/httpdocs/admin/ |
| Current File : /var/www/vhosts/ccp.ac.th/smtp.ccp.ac.th/httpdocs/admin/user.php |
<!doctype html>
<html lang="en">
<!-- head -->
<?php include 'head.php'; ?>
<?php include '../db/database.php'; ?>
<body>
<div class="wrapper">
<!-- เมนูด้านซ้าย -->
<?php include 'leftside.php'; ?>
<div class="main-panel">
<!-- ส่วนหัว -->
<?php include 'header.php'; ?>
<div class="content">
<div class="container-fluid">
<div class="col-md-12">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="home.php">หน้าหลัก</a></li>
<li class="breadcrumb-item active" aria-current="page">จัดการผู้ใช้งาน</li>
</ol>
</nav>
<a href="adduser.php">
<button type="button" class="btn btn-primary"><i class="material-icons">person_add</i> เพิ่มผู้ใช้งาน</button>
</a>
<?php
$sql = "SELECT * FROM user WHERE admin_status = '0' ORDER BY user_id DESC";
$result = mysqli_query($link, $sql);
?>
<div class="card">
<div class="card-header card-header-icon" data-background-color="rose">
<i class="material-icons">assignment_ind</i>
</div>
<h4 class="card-title">จัดการผู้ใช้งาน</h4>
<div class="card-content">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th class="text-center">ลำดับ</th>
<th>ชื่อ</th>
<th>นามสกุล</th>
<th>ชื่อผู้ใช้งาน</th>
<th>สถานะ</th>
<th class="text-right">จัดการ</th>
</tr>
</thead>
<tbody>
<?php
$i=1;
while ($row = mysqli_fetch_array($result)) { ?>
<tr>
<?php
if ($row['login_status'] == 0){
$status = 'ผู้ดูแลเว็บ';
}else{
$status = 'ผู้ดูแลระบบ';
}
?>
<td class="text-center"><?php echo $i; ?></td>
<td><?php echo $row['name']; ?> </td>
<td><?php echo $row['last_name']; ?> </td>
<td><?php echo $row['username']; ?></td>
<td> <?php echo $status ?></td>
<td class="td-actions text-right">
<a href="frm_edituser.php?user_id=<?php echo $row['user_id']; ?>" title="แก้ไขข้อมูล" type="button" rel="tooltip" class="btn btn-success btn-round">
<i class="material-icons">edit</i>
</a>
<button id="<?php echo $row['user_id']; ?>" title="ลบข้อมูล" rel="tooltip" class="btn btn-danger btn-round">
<i class="material-icons">close</i>
</button >
</td>
</tr>
<?php $i++; } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- footer1 -->
<?php include 'footer1.php'; ?>
</div>
</div>
<!-- footer2 -->
<?php include 'footer2.php'; ?>
<script>
$(document).ready(function(){
$(".btn-danger").on("click",function(e) {
//delete confirm
var uid = $(this).attr('id');
swal({
title: "คุณแน่ใจหรือไม่ว่าต้องการลบข้อมูล?",
text: "คุณจะไม่สามารถกู้คืนข้อมูลนี้ได้อีก!",
type: "warning",
showCancelButton: true,
confirmButtonColor: '#d33',
confirmButtonText: "ตกลง, ลบข้อมูล!",
cancelButtonText: "ยกเลิก..",
closeOnConfirm: false,
closeOnCancel: false
},
function(isConfirm) {
if (isConfirm) {
$.get("del_user.php", {id : uid})
.done(function (data) {
if (data.status === "success") {
$.smkAlert({text: data.message, type: data.status});
} else {
$.smkAlert({text: data.message, type: data.status});
}
location.reload();
});
} else {
swal("ยกเลิก", "ข้อมูลของคุณยังไม่ถูกลบ :)", "error");
}
});
e.preventDefault();
});
});
</script>
<!-- Mirrored from demos.creative-tim.com/material-dashboard-pro/examples/dashboard.html by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 20 Mar 2017 21:32:16 GMT -->
</html>