<?php
require ('authentication_manager.php');
?>
<script language="javascript" type="text/javascript">
<!--

function setCredit(t) {
  if(t){
    $('creditV').style.display='block';
    $('creditV').innerHTML=$('creditV').innerHTML.replace(/加\/减|增加|减掉/g,t);
  }else{
    $('creditV').style.display='none';
  }
}

-->
</script>
<?php

/* 管理信誉值 */
/* 162100源码 - 162100.com */
$text = $err = '';
$_GET['act'] = @$_GET['act'];
if ($_GET['act'] == 'check_credit_warning') {
  $where_eval = ' type="1" AND check_credit="2"';
  $list_title = '"<a href=\"?get=member_credit\">待审核信誉记录</a><a class=\"list_title_in\">审核未通过的信誉记录<span>（".$n."）</span></a><a href=\"?get=member_credit&act=show\">所有通过的信誉记录</a>"';

} elseif ($_GET['act'] == 'show') {
$_GET['username'] = @$_GET['username'];
  if ($_GET['username']) {
    $_GET['username'] = strtolower(trim($_GET['username']));
    $_GET['username'] = str_replace('.', '&#46;', $_GET['username']);
    if (preg_match('/^([^\x00-\x7f]|\w|&#46;){3,45}$/', $_GET['username'])) {
      $where_eval = ' username="'.$_GET['username'].'" AND type="1" AND check_credit="0"';
      $search_r = '搜索结果 - ';
    } else {
      $where_eval = ' type="1" AND check_credit="0"';
      $search_r = '<span class=\"red\">用户名不合法</span> | ';
    }
  } else {
    $where_eval = ' type="1" AND check_credit="0"';
  }
  $list_title = '"<a href=\"?get=member_credit\">待审核信誉记录</a><a href=\"?get=member_credit&act=check_credit_warning\">审核未通过的信誉记录</a><a class=\"list_title_in\">'.$search_r.'所有通过的信誉记录<span>（".$n."）</span></a>"';
  $search_bar = ' | 按用户名 <input name="username" id="username" value="'.$_GET['username'].'" type="text" size="20" /><button name="button" type="button" onClick="location.href=\'?get=member_credit&act=show&username=\'+encodeURIComponent($(\'username\').value)+\'\'"><b>搜索</b></button>';

} else {
  $where_eval = ' type="1" AND check_credit="1"';
  $list_title = '"<a class=\"list_title_in\">待审核信誉记录<span>（".$n."）</span></a><a href=\"?get=member_credit&act=check_credit_warning\">审核未通过的信誉记录</a><a href=\"?get=member_credit&act=show\">所有通过的信誉记录</a>"';
}












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'.$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'.$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 width="200">用户名</th>
      <th width="200">信誉值明细</th>
      <th width="200">日期</th>
      <th>值</th>
    </tr>
  </table>
</div>
';
    while ($row = @mysql_fetch_assoc($result)) {
      $row['other'] = preg_replace('/^(0|1)/', '', $row['other']);
      $text .= '
<div class="li">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="200" style="text-align:left;"><input name="id[]" id="id[]" type="checkbox" class="checkbox" value="'.$row['id'].'" /><input name="username['.$row['id'].']" type="hidden" value="'.$row['username'].'" /> '.$row['username'].'</td>
      <td width="200" style="text-align:center;"><input name="description['.$row['id'].']" type="hidden" value="'.$row['description'].'" /><a href="obj.php?title='.$row['other'].'" target="_blank" title="点击浏览">'.$row['description'].'</a></td>
      <td width="200" style="text-align:center;">'.$row['date'].'</td>
      <td style="text-align:center;">'.(float)$row['money'].'</td>
    </tr>
  </table>
</div><input name="other['.$row['id'].']" type="hidden" value="'.$row['other'].'" />
';
    }
    @mysql_free_result($result);

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

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

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

@mysql_close();

?>
<div class="column"><b>提示：</b>删除操作要谨慎！删除正值相当于减信誉值，删除负值相当于给用户加信誉值。</div>
  <div class="list_title"><?php echo eval('return '.$list_title.';'); ?></div>
  <form method="post" id="manageform" action="?post=unity_run&dataname=myaccount" onsubmit="if(get_checkbox('id[]')==0){alert ('请点选！');return false;}">
    <div class="manager_menu">
      <table border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="120"><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></td>
          <td><?php echo $_GET['act'] != 'show' ? '
<button name="act" type="button" onmouseover="setCredit(\'增加\');"><b>审核通过</b></button>' : ''; ?><?php echo $_GET['act'] == 'check_credit_warning' ? '' : $_GET['act'] != 'show' ? '
<button type="button" name="act2" onmouseover="setCredit(\'\');" onclick="chk(this.form,this,\'check_credit_warning\')"><b>审核不通过</b></button>' : ''; ?>

<button type="button" name="act2" onmouseover="setCredit('');" onclick="chk(this.form,this,'delcredit')"><b>删除</b></button> <?php echo @$search_bar; ?>
           <div id="creditV" style="display:none">同时操作：加/减<input name="funds_value" onkeyup="isDigit(this,1,0,'.')" type="text" size="6" value="1.00" />可用（货币）分，加/减<input name="credit_value" onkeyup="isDigit(this,0,1,'.')" type="text" size="6" value="1" />信誉值 <button name="act" type="button" onclick="chk(this.form,this,'check_credit')"><b>提交审核</b></button></div>
          </td>
        </tr>
      </table>
    </div>
    <?php
echo $text, $err;
?>
    <input type="hidden" name="limit" />
  </form>
  