<?php
require 'authentication.php'; // admin authentication check 

// auth check
$user_id = $_SESSION['admin_id'];
$user_name = $_SESSION['name'];
$security_key = $_SESSION['security_key'];
if ($user_id == NULL || $security_key == NULL) {
    header('Location: index.php');
}
//  Author Name: Mayuri K. 
 // for any PHP, Codeignitor, Laravel OR Python work contact me at mayuri.infospace@gmail.com  
 //Visit website : www.mayurik.com
// check admin
$user_role = $_SESSION['user_role'];
if ($user_role != 1) {
  header('Location: task-info.php');
}

$page_name="Admin";
include("include/sidebar.php");

?>

//  Author Name: Mayuri K. 
 // for any PHP, Codeignitor, Laravel OR Python work contact me at mayuri.infospace@gmail.com  
 //Visit website : www.mayurik.com

    <div class="row">
      <div class="col-md-12">
        <div class="well well-custom">
          <ul class="nav nav-tabs nav-justified nav-tabs-custom">
            <li class="active"><a href="manage-admin.php">Manage Admin</a></li>
            <li><a href="admin-manage-user.php">Manage Employee</a></li>
          </ul>
          <div class="gap"></div>
          <div class="table-responsive">
            <table class="table table-codensed  display" id="example" style="width:100%">
              <thead>
                <tr>
                  <th>Serial No.</th>
                  <th>Name</th>
                  <th>Email</th>
                  <th>Username</th>
                  <th>Details</th>
                </tr>
              </thead>
              <tbody>

              <?php 
                $sql = "SELECT * FROM tbl_admin WHERE user_role = 1";
                $info = $obj_admin->manage_all_info($sql);

                $serial  = 1;
                $total_expense = 0.00;
                while( $row = $info->fetch(PDO::FETCH_ASSOC) ){
              ?>
                <tr>
                  <td><?php echo $serial; $serial++; ?></td>
                  <td><?php echo $row['fullname']; ?></td>
                  <td><?php echo $row['email']; ?></td>
                  <td><?php echo $row['username']; ?></td>
                  
                  <td><a class="btn btn-primary btn-sm" title="Update Admin" href="update-admin.php?admin_id=<?php echo $row['user_id']; ?>"><span class="glyphicon glyphicon-edit"></span></a>&nbsp;&nbsp;</td>
                </tr>
                
              <?php  } ?>
    
              </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>

<!-- //  Author Name: Mayuri K. 
 // for any PHP, Codeignitor, Laravel OR Python work contact me at mayuri.infospace@gmail.com  
 //Visit website : www.mayurik.com -->
<?php
if(isset($_SESSION['update_user_pass'])){

  echo '<script>alert("Password updated successfully");</script>';
  unset($_SESSION['update_user_pass']);
}
include("include/footer.php");

?>