<?php
$getId = base64_decode($_GET['id']);
$query = mysql_query("SELECT * FROM servers WHERE id = + $getId");
$result = mysql_fetch_array($query);

require_once('whm.class.php');


$whmdomain = $result['domain'];
$whmuser = $result['user'];
$whmpwd = $result['pwd'];

$WHM = new WHM( false , $whmdomain, $whmuser, $whmpwd);

$pk = $_GET['package'];
$accounts = $WHM->search_account_by_package($pk);

?>



    <!-- Content Wrapper. Contains page content -->
      <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1>
            <?php echo $lang['TITLE_LIST_ACC']; ?> - <?php echo $result['server']; ?>: Package <?php echo $_GET['package']; ?>
          </h1>
          
        </section>
	
	  
       <section class="content">
          <div class="row">
            <div class="col-xs-12">
				
              <div class="box">
                <div class="box-header">
                  <div class="box-header"><a href="?mod=Packages" class="btn btn-default"><?php echo $lang['BACK']; ?></a>
                </div><!-- /.box-header -->
                <div class="box-body">
                  <table id="tabela" class="table table-striped table-hover">
                    <thead>
                      <tr>
						<th><?php echo $lang['SRV_ACC_USER']; ?></th>
                        <th><?php echo $lang['SRV_ACC_DOMAIN']; ?></th>
                        <th>Disk Limit</th>
                        <th>Disk Used</th>
                        <th>Status</th>
                        <th><?php echo $lang['ACTIONS']; ?></th>
                      </tr>
                    </thead>
                    <tbody>
					<?php
					foreach ($accounts as $ac){
	                ?>
		            <tr>
					<td><?php echo $ac["user"]; ?></td>
		            <td><?php echo $ac["domain"]; ?></td>
		            <td><?php echo $ac["disklimit"]; ?></td>
		            <td><?php echo $ac["diskused"]; ?></td>
		            <td><?php if($ac["suspended"] == '1') { ?><span class="label label-danger">SUSPENDED</span><? } else { ?><span class="label label-success">ACTIVE</span><?php } ?></td>

		            <td width="235">
		            <a href="javascript:void(0);" onclick="javascript: if (confirm('You want to suspend this account ?')) { window.location.href='?mod=ListAcc&id=<?php echo $_GET['id']; ?>&acc=<?php echo $ac["user"]; ?>&action=suspend' } else { void('') };" class="btn btn-warning btn-sm">Suspend</a>
		            <a href="javascript:void(0);" onclick="javascript: if (confirm('You want to unsuspend this account ?')) { window.location.href='?mod=ListAcc&id=<?php echo $_GET['id']; ?>&acc=<?php echo $ac["user"]; ?>&action=unsuspend' } else { void('') };" class="btn btn-info btn-sm">Unsuspend</a>
		            <a href="javascript:void(0);" onclick="javascript: if (confirm('You want to terminate this account ?')) { window.location.href='?mod=ListAcc&id=<?php echo $_GET['id']; ?>&acc=<?php echo $ac["user"]; ?>&action=terminate' } else { void('') };" class="btn btn-danger btn-sm">Terminate</a>
		            </td>
		            </tr>
					<?php } ?>
					
                    </tbody>
                    <tfoot>
                      <tr>
                        <th><?php echo $lang['SRV_ACC_USER']; ?></th>
                        <th><?php echo $lang['SRV_ACC_DOMAIN']; ?></th>
                        <th>Disk Limit</th>
                        <th>Disk Used</th>
                        <th>Status</th>
                        <th><?php echo $lang['ACTIONS']; ?></th>
                      </tr>
                    </tfoot>
                  </table>
                </div><!-- /.box-body -->
              </div><!-- /.box -->
       
           </div><!-- /.col -->
          </div><!-- /.row -->
        </section><!-- /.content -->
       
       
        
        
      </div><!-- /.content-wrapper -->
   
   
   
   
