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

/* 注册审核 */
/* 162100源码 - 162100.com */



$search_r = $text = $err = '';
$_GET['username'] = @$_GET['username'];

if ($_GET['username']) {
  $_GET['username'] = strtolower(trim($_GET['username']));
  if (preg_match('/^([^\x00-\x7f]|\w|\.){3,45}$/', $_GET['username'])) {
    $_GET['username'] = str_replace('.', '&#46;', $_GET['username']);
    $eval = ' (username LIKE "%'.$_GET['username'].'%") AND'; //走索引的话 (username LIKE "'.$_GET['username'].'%") AND
    $search_r = '搜索结果 - ';
  } elseif (preg_match('/^[\w\.\-]+@[\w\.\-]+\.[\w\.]+$/', $_GET['username'])) {
    $eval = ' (email LIKE "%'.$_GET['username'].'%") AND'; //走索引的话 (email LIKE "'.$_GET['username'].'%") AND
    $search_r = '搜索结果 - ';
  } else {
    $search_r = '<span class=\"red\">用户名|邮箱名不合法</span> | ';
  }
}
$_GET['act'] = @$_GET['act'];

if ($_GET['act'] == 'punished') {
  $where_eval = '2';
  $list_title = '"<div class=\"list_title\"><a href=\"?get=member_check_reg\">待审批注册用户列表</a><a class=\"list_title_in\">'.$search_r.'黑名单<span>（".$n."）</span></a></div>"';
  $choose = '<button name="act" type="button" onclick="chk(this.form,this,\'out_punished\')"><b>解除</b></button>';
} else {
  $where_eval = '1';
  $list_title = '"<div class=\"list_title\"><a class=\"list_title_in\">'.$search_r.'待审批注册用户列表<span>（".$n."）</span></a><a href=\"?get=member_check_reg&act=punished\">黑名单</a></div>"';
  $choose = '<button name="act" type="button" onclick="chk(this.form,this,\'check_reg\')"><b>审批通过</b></button>';
}

$n = 0;


if (!isset($sql['db_err'])) {
  db_conn();
}

if ($sql['db_err'] == '') {

  $result = @mysql_query('SELECT COUNT(id) AS total FROM '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].' WHERE'.$eval.' check_reg="'.$where_eval.'"', $db);
  $row = @mysql_fetch_assoc($result);
  $n = abs($row['total']);
  @mysql_free_result($result);
  unset($row);

  require ('inc/function/get_page.php');
  if ($n > 0) :
    $p = get_page($n); //页数
    $seek = $web['pagesize'] * ($p-1);
    $result = @mysql_query('SELECT * FROM '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].' WHERE'.$eval.' check_reg="'.$where_eval.'" ORDER BY id DESC LIMIT '.$seek.','.$web['pagesize'].'', $db);

    $text .= '
<div class="list_title_">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <th>用户名</th>
      <th width="220">积分/权限</th>
    <th width="220">详细</th>
    </tr>
  </table>
</div>
';
    while ($row = @mysql_fetch_assoc($result)) {
      $text .= '
  <div class="li">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr valign="top">
    <td style="text-align:left;"><input name="id[]" id="id[]" type="checkbox" class="checkbox" value="'.$row['username'].'" />
    '.$row['username'].'</td>
    <td width="220" style="text-align:left;">
    邮箱:'.$row['email'].'&nbsp;<br />
    注册日期:'.$row['regdate'].'&nbsp;</td>
    <td width="220" style="text-align:left;">
    密码问题:'.$row['password_question'].'&nbsp;<br />
    密码答案:'.$row['password_answer'].'&nbsp;
    </td>
    </tr>
    </table>
  </div>';
    }
    @mysql_free_result($result);

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

  else :
    $err .= '没有记录！';
  endif;


} else {
  $err .= $sql['db_err'];
}

@mysql_close();

?>
<?php echo eval('return '.$list_title.';'); ?>
<form method="post" id="manageform" action="?post=unity_run&dataname=member" onsubmit="if(get_checkbox('id[]')==0){alert ('请点选！');return false;}">
  <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;
    <?php echo $choose; ?>
    <button name="act" type="button" onclick="chk(this.form,this,'del')"><b>删除</b></button> | <input name="username" id="usernamebox" type="text" value="<?php echo $_GET['username']; ?>" size="20" />
    <button type="button" onclick="location.href='?get=member_check_reg&act=<?php echo $_GET['act']; ?>&username='+encodeURIComponent($('usernamebox').value)+''"><b>搜索会员|邮箱</b></button> <input type="hidden" name="delcomplete" value="1" />
  </div>
  <?php
echo $text, $err;
?>
  <input type="hidden" name="limit" />
</form>
