MINI MINI MANI MO
<!doctype html>
<?php
session_start();
if($_SESSION['admin_id'] == "")
{
include("session.php");
}
include("connect.php");
?>
<html>
<head>
<?php include("assets/include/link.php"); ?>
</head>
<body>
<div class="wrapper">
<?php include("nav-menu.php"); ?>
<div class="main-panel">
<?php include("assets/include/account.php"); ?>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="card card-plain">
<div class="header">
<h4 class="title"><a href="user.php"><i class="pe-7s-users fa-fw fa-lg"></i> Administrator</a></h4>
</div>
<?php
$strSQL = "SELECT * FROM admin WHERE admin_id = '".$_SESSION['admin_id']."'";
$objQuery = mysqli_query($objCon,$strSQL);
$objResult = mysqli_fetch_array($objQuery,MYSQLI_ASSOC);
?>
<?php
if($_SESSION["admin_id"] == 1)
{
?>
<?php
$strSQL = "SELECT * FROM admin";
$objQuery = mysqli_query($objCon,$strSQL);
?>
<div class="content table-responsive table-full-width">
<a href="add_user.php">
<button type="button" rel="tooltip" class="btn btn-info btn-simple btn-icon">
<i class="fa fa-plus-circle"></i> Add Account
</button>
</a>
<table class="table table-hover">
<thead>
<th style="width:20%;">Username</th>
<th style="width:20%;">Full Name</th>
<th style="width:20%;">Phone Number</th>
<th style="width:15%;"><div align="center">Status</div></th>
<th style="width:15%;"><div align="center">Manage</div></th>
</thead>
<?php
while($objResult = mysqli_fetch_array($objQuery,MYSQLI_ASSOC))
{
?>
<tbody>
<tr>
<td><?php echo $objResult["username"];?></td>
<td><?php echo $objResult["name"];?></td>
<td><?php echo $objResult["tel"];?></td>
<td><div align="center"><?php echo $objResult["status"];?></div></td>
<td>
<div align="center">
<?php
if($objResult["admin_id"] != 1)
{
?>
<a href="JavaScript:if(confirm('Are you sure you want to delete this item ?')==true){window.location='deleteuser.php?admin_id=<?php echo $objResult['admin_id'];?>'}">
<button type="submit" rel="tooltip" class="btn btn-danger btn-sm btn-simple">
<i class="fa fa-window-close" aria-hidden="true"></i> Remove
</button>
</a>
<?php
}else{
?>
<button type="button" rel="tooltip" class="btn btn-default btn-sm btn-simple" title="แก้ไขข้อมูล" onclick="window.location.href='edit_user.php?admin_id=<?php echo $objResult['admin_id'];?>'">
<i class="fa fa-pencil-square" aria-hidden="true"></i> Edit
</button>
<?php
}
?>
</div>
</td>
</tr>
</tbody>
<?php
}
?>
</table>
</div>
<?php
}else{
?>
<?php
$strSQL = "SELECT * FROM admin WHERE admin_id = '".$_SESSION['admin_id']."' ";
$objQuery = mysqli_query($objCon,$strSQL);
$objResult = mysqli_fetch_array($objQuery,MYSQLI_ASSOC);
?>
<div class="content table-responsive table-full-width">
<table class="table table-hover">
<thead>
<th style="width:20%;">Username</th>
<th style="width:20%;">Full Name</th>
<th style="width:20%;">Phone Number</th>
<th style="width:15%;"><div align="center">Status</div></th>
<th style="width:15%;"><div align="center">Manage</div></th>
</thead>
<tbody>
<tr>
<td><?php echo $objResult["username"];?></td>
<td><?php echo $objResult["name"];?></td>
<td><?php echo $objResult["tel"];?></td>
<td><div align="center"><?php echo $objResult["status"];?></div></td>
<td>
<div align="center">
<button type="button" rel="tooltip" class="btn btn-default btn-sm btn-simple" onclick="window.location.href='edit_user.php?admin_id=<?php echo $objResult['admin_id'];?>'">
<i class="fa fa-edit"></i> Edit
</button>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<?php
}
?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
<?php include("assets/include/script.php"); ?>
</html>
<?php
mysqli_close($objCon);
?>
OHA YOOOO