<?php

/* ========================================================================
 * $Id: badip.php 2500 2017-11-30 09:27:23Z onez $
 * 
 * Email: www@onez.cn
 * QQ: 6200103
 * HomePage: http://www.onezphp.com
 * ========================================================================
 * Copyright 2016-2017 佳蓝科技.
 * 
 * ======================================================================== */

!defined('IN_ONEZ') && exit('Access Denied');

$groupid=(int)onez()->gp('groupid');

$G['title']='IP黑名单';
$action=onez()->gp('action');
if($action=='delete'){
  $id=(int)onez()->gp('id');
  $G['this']->data()->open('group_badip')->delete("id='$id' and upid='$groupid'");
  onez()->ok('删除IP成功','reload');
}
$xxx="";



onez('admin')->header();

$record=$G['this']->data()->open('group_badip')->page("1$xxx and upid='$groupid' order by id desc");
?>
<section class="content-header">
  <h1>
    <?php echo $G['title']?><small></small>
  </h1>
  <ol class="breadcrumb">
    <li>
      <a href="<?php echo onez()->href('/')?>">
        <i class="fa fa-dashboard">
        </i>
        管理首页
      </a>
    </li>
    <li class="active">
      <?php echo $G['title']?>
    </li>
  </ol>
</section>
<section class="content">
  <div class="btns" style="padding-bottom: 10px">
    <div class="pull-left">

      <a href="<?php echo onez()->href('/badip.edit.php&groupid='.$groupid)?>" data-width="960" class="onez-miniwin btn btn-success">
        添加IP
      </a>

    </div>
    <div class="pull-right">
    </div>
    <div class="clearfix"></div>
  </div>
  <div class="box box-info">
    <div class="box-header with-border">
      <h3 class="box-title">
        <?php echo $G['title']?>
      </h3>
      <div class="box-tools pull-right">
      </div>
    </div>
    <div class="box-body  table-responsive no-padding">
      <table class="table table-striped">
        <thead>
          <tr>
            <th>IP地址</th>
            <th>备注说明</th>
            <th>过期时间</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody class="todo-list">
          <?php foreach($record[0] as $rs){ ?>
          <tr>
            <td><?php echo $rs['token']?></td>
            <td><?php echo $rs['summary']?></td>
            <td><?php echo date('Y-m-d H:i:s',$rs['index2'])?></td>
            <td>
              <a href="<?php echo onez()->href('/badip.edit.php?id='.$rs['id'].'&groupid='.$groupid)?>" data-width="960" class="onez-miniwin btn btn-xs btn-success">
                编辑
              </a>
              <a href="javascript:void(0)" onclick="onez.del('<?php echo $rs['id']?>')" class="btn btn-xs btn-danger">
                删除
              </a>
            </td>
          </tr>
          <?php }?>
        </tbody>
      </table>
    </div>
<?php if($record[1]){ ?>
    <div class="box-footer clearfix">
      <?php echo $record[1]?>
    </div>
<?php  } ?>
  </div>
</section>
<?php
onez('admin')->footer();
?>