<?php include("../templates/header.php"); ?>
<?php include("check_admin.php"); ?>

<div class="panel panel-primary">
  <div class="panel-heading">
    <h3 class="panel-title">รายชื่อสมาชิก</h3>
  </div>
  <div class="panel-body">

  <a href="create_acc.php" class="btn btn-success"><span class="glyphicon glyphicon-user"></span> สร้างบัญชีใหม่</a><br><br>

  <table class="table table-bordered" >
    <thead>
      <tr>
        <th>ลำดับ</th>
        <th>Username</th>
        <th>ชื่อ-สกุล</th>
        <th>เบอร์ติดต่อ</th>
        <th>สถานะ</th>
        <th>คอมทั่วไป</th>
        <th>คอมเลขวิ่ง</th>
        <th>จัดการ</th>
      </tr>
    </thead>
    <tbody>

  <?php

  include("../config/mysql_connect.php");

 	$sql = "select * from tb_account"; 
 	$Query = mysqli_query($link,$sql);
		
	$count = 0;

	while($Result = mysqli_fetch_array($Query)){
	$acc_id = $Result['acc_id'];
	$acc_user = $Result['acc_user'];
	$acc_fname = $Result['acc_fname'];
	$acc_lname = $Result['acc_lname'];
	$acc_phone = $Result['acc_phone'];
	$acc_commission = $Result['acc_commission'];
	$acc_status = $Result['acc_status'];
	$acc_lastupdate = $Result['acc_lastupdate'];

  $rate1 = $Result['rate1'];
  $rate2 = $Result['rate2'];
  $rate3 = $Result['rate3'];
  $rate4 = $Result['rate4'];
  $rate5 = $Result['rate5'];
  $rate6 = $Result['rate6'];
  $acc_com5 = $Result['acc_com5'];
	
	$count = $count+1;

	echo"<tr>
        <td align='center'>$count</td>
        <td>$acc_user</td>
        <td>$acc_fname $acc_lname</td>
        <td>$acc_phone</td>
        <td align='center'>$acc_status</td>
        <td align='center'>$acc_commission%</td>
        <td align='center'>$acc_com5%</td>
        <td>
        <a href='edit_acc.php?id=$acc_id' class='btn btn-default btn-xs'><span class='glyphicon glyphicon-edit'></span> แก้ไข</a>
		<a href='delete_acc.php?id=$acc_id' class='btn btn-danger btn-xs'><span class='glyphicon glyphicon-trash'></span> ลบ</a>
        </td>
      </tr>";
	}

  ?>
    </tbody>
  </table>

  </div>
</div>

<?php include("../templates/footer.php"); ?>