<?php
require ('authentication_manager.php');
?>
<?php

/* 管理无效订单 */
/* 162100源码 - 162100.com */


$_GET['filename'] = preg_replace('/[^\d]/', '', $_GET['filename']);
$seach_mark = !empty($_GET['filename']) ? '*'.$_GET['filename'].'*' : '*';

eval('@chmod(\'__temp__/order\', 0'.$web['chmod'].');');
$n = 0;
if ($file_arr = @glob('__temp__/order/'.$seach_mark.'.txt')) {
  $n = count($file_arr);
}
@ require ('inc/function/get_page.php');
@ require ('inc/function/get_date.php');
if ($n > 0) {
  $p = get_page($n); //页数
  $seek = $n - $web['pagesize'] * ($p-1);
  $end = $seek - $web['pagesize'] > 0 ? $seek - $web['pagesize'] : 0;
  $text .= '
<div class="list_title_">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <th>订单号</th>
      <th width="100">金额</th>
      <th width="200">用户名</th>
      <th width="200">日期</th>
    </tr>
  </table>
</div>
';
  for ($i = $seek; $i > $end; $i--) {
    $file = basename($file_arr[$i - 1], '.txt');
    $fcon = @file_get_contents($file_arr[$i - 1]);
    list($money, $username) = @explode('|', $fcon);
    $text .= '
  <div class="li">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td style="text-align:left;"><input name="id[]" id="id[]" type="checkbox" class="checkbox" value="'.$file.'" /> '.$file.'</td>
        <td width="100" style="text-align:center;">'.$money.'</td>
        <td width="200" style="text-align:center;">'.$username.'</td>
        <td width="200" style="text-align:center;">'.get_date($file).'</td>
      </tr>
    </table>
  </div>
';
    unset($file, $fcon, $money, $username);
    @clearstatcache();

  }

  $text .= get_page_foot($n, $web['pagesize'], $p, '?get=member_badorder&p=');

} else {
  $err .= '没有订单记录！';
}


?>
<div class="list_title"><a class="list_title_in">无效订单记录<span>（<?php echo $n; ?>）</span></a></div>
<form method="post" id="manageform" action="?post=unity_run&dataname=member" onsubmit="addSubmitSafe()">
  <div class="manager_menu"> <a href="javascript:void(0)" onclick="allChoose(true,true);return false;">全选</a> - <a href="javascript:void(0)" onclick="allChoose(true,false);return false;">反选</a> - <a href="javascript:void(0)" onclick="allChoose(false,false);return false;">不选</a> &nbsp;&nbsp;
      <button name="act" type="button" onclick="chk(this.form,this,'del_badorder')"><b>删除</b></button>
    | 搜索订单
    <input name="filename" id="filename" onkeyup="if(isNaN(this.value)){alert('请输入数字');this.value='';}" value="<?php echo $_GET['filename'] ? $_GET['filename'] : ''; ?>" type="text" size="20" />
      <button name="button" type="button" onclick="location.href='?get=member_badorder&filename='+encodeURIComponent($('filename').value)+''"><b>搜索</b></button>
  </div>
  <?php
echo $text, $err;
?>
  <input type="hidden" name="limit" />
</form>
