<?php

/* 成员列表 */
/* 162100源码 - 162100.com - download.162100.com */

$title = '成员';

@ require ('inc/set/set.php');
@ require ('inc/set/set_sql.php');
@ require ('inc/set/set_userface.php');
@ require ('inc/function/confirm_power.php');
//身份验证
define('POWER', confirm_power());
$userface = user_class(POWER, $session[3]);


//身份图像
function users_class($power, $point, $username) {
  global $web;
  if ($power == 'm') {
    $image = '<img src="inc/images/manager'.($username == $web['manager'] ? ($a = '_base') : '').'.gif" title="管理员'.$a.'">';
  } elseif (preg_match('/\d+/', $power)) {
    $image = '<img src="inc/images/admin_big.gif" title="版主">';
  } else {
    if ($point <= abs($web['class_iron'])) {
      $www = $point < 0 ? 0 : ceil($point / (abs($web['class_iron']) / 10) * 3);
      $image = '<img src="inc/images/iron.gif" width="'.($www + 3).'" height="16" title="积分'.$point.'-铁级用户">';
    } elseif ($point > abs($web['class_iron']) && $point <= abs($web['class_silver'])) {
      $image = '<img src="inc/images/silver.gif" width="'.(ceil($point / (abs($web['class_silver']) / 10) * 3) + 3).'" height="16" title="积分'.$point.'-银级用户">';
    } elseif ($point > abs($web['class_slive']) && $point <= abs($web['class_gold'])) {
      $image = '<img src="inc/images/gold.gif" width="'.(ceil($point / (abs($web['class_gold']) / 10) * 3) + 3).'" height="16" title="积分'.$point.'-金级用户">';
    } else {
      $text = '';
      $n = ceil($point / abs($web['class_gold'])) - 1;
      for ($i = 0; $i < $n; $i++) {
        $text .= '<img src="inc/images/diamond.gif">';
      }
      return '<span title="积分'.$point.'-'.$n.'钻级用户">'.$text.'</span>';
    }
  }
  return $image;
}

function get_diamond($n) {
  $text = '';
  for ($i = 0; $i < $n; $i++) {
    $text .= '<img src="inc/images/diamond.gif">';
  }
  return '<span title="积分'.$point.'-'.$n.'钻级用户">'.$text.'</span>';
}
$_GET['act'] = @ $_GET['act'];
$_GET['order'] = @ $_GET['order'];
if ($_GET['order'] != 'username' && $_GET['order'] != 'point' && $_GET['order'] != 'writecount' && $_GET['order'] != 'regdate') {
  $_GET['order'] = 'id';
}
if ($_GET['act'] == 'punished') {
  $list_title = '"  <a href=\"list_member.php\">成员记录</a><a href=\"?act=limit_t\">发表受限</a><a href=\"?act=limit_r\">评论受限</a><a href=\"?act=limit_u\">上载受限</a><a href=\"?act=checking\">审核中</a><a class=\"list_title_in\">".$search_r."黑名单<span>（".$n."）</span></a>"';
  $list_title_ = '"
<div class=\"list_title_\">
  <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
    <tr>
      <th>用户名</th>
      <th width=\"200\">除名时间</th>
      <th width=\"425\" style=\"padding-right:7px;\">原因</th>
    </tr>
  </table>
</div>
"';
  $list_text = '"
<div class=\"li\">
  <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
    <tr>
      <td style=\"text-align:left;\"><a class=\"li_a\" href=\"user.php?get=card&username=".urlencode($row["username"])."\" target=\"_blank\" title=\"点击查看发布人名片\"><b>".$row["username"]."</b></a> ".users_class($row["power"], $row["point"], $row["username"])."&nbsp;</td>
      <td width=\"200\" align=\"center\">".get_date_c($row["thisdate"])."&nbsp;</td>
	  <td width=\"425\" align=\"center\">".$row["other"]."&nbsp;</td>
    </tr>
  </table>
</div>
"';
  $t_ = ' &gt; 黑名单';
  $w_ = '2';
  $r_ = 'username,power,point,thisdate,other';
} else {
  if ($_GET['act'] == 'limit_t') {
    $list_title = '"  <a href=\"list_member.php\">成员记录</a><a class=\"list_title_in\">".$search_r."发表受限<span>（".$n."）</span></a><a href=\"?act=limit_r\">评论受限</a><a href=\"?act=limit_u\">上载受限</a><a href=\"?act=checking\">审核中</a><a href=\"?act=punished\">黑名单</a>"';
    $w_ = '" AND power LIKE "%t%';
  } elseif ($_GET['act'] == 'limit_r') {
    $list_title = '"  <a href=\"list_member.php\">成员记录</a><a href=\"?act=limit_t\">发表受限</a><a class=\"list_title_in\">".$search_r."评论受限<span>（".$n."）</span></a><a href=\"?act=limit_u\">上载受限</a><a href=\"?act=checking\">审核中</a><a href=\"?act=punished\">黑名单</a>"';
    $w_ = '" AND power LIKE "%r%';
  } elseif ($_GET['act'] == 'limit_u') {
    $list_title = '"  <a href=\"list_member.php\">成员记录</a><a href=\"?act=limit_t\">发表受限</a><a href=\"?act=limit_r\">评论受限</a><a class=\"list_title_in\">".$search_r."上载受限<span>（".$n."）</span></a><a href=\"?act=checking\">审核中</a><a href=\"?act=punished\">黑名单</a>"';
    $w_ = '" AND power LIKE "%u%';
  } elseif ($_GET['act'] == 'checking') {
    $list_title = '"  <a href=\"list_member.php\">成员记录</a><a href=\"?act=limit_t\">发表受限</a><a href=\"?act=limit_r\">评论受限</a><a href=\"?act=limit_u\">上载受限</a><a class=\"list_title_in\">".$search_r."审核中<span>（".$n."）</span></a><a href=\"?act=punished\">黑名单</a>"';
    $w_ = '1';
  } else {
    $list_title = '"  <a class=\"list_title_in\">".$search_r."成员记录<span>（".$n."）</span></a><a href=\"?act=limit_t\">发表受限</a><a href=\"?act=limit_r\">评论受限</a><a href=\"?act=limit_u\">上载受限</a><a href=\"?act=checking\">审核中</a><a href=\"?act=punished\">黑名单</a>"';
    $w_ = '0';
  }
  $list_title_ = '"
<div class=\"list_title_\">
  <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
    <tr>
      <th><button type=\"button\" class=\"small\"'.($_GET['order'] == 'username' ? ' title=\"当前按帐户名排序\" disabled=\"disabled\"><b style=\"color:#D8D8D8\">帐户名︾' : ' title=\"点此按帐户名排序\" onclick=\"location.href=location.search.replace(/&?order=[a-z]*/,\'\').replace(/\??/,\'?order=username&\').replace(/&+/,\'&\');\"><b>帐户名︽').'</b></button></th>
      <th width=\"80\"><button type=\"button\" class=\"small\"'.($_GET['order'] == 'point' ? ' title=\"当前按等级分排序\" disabled=\"disabled\"><b style=\"color:#D8D8D8\">等级分︾' : ' title=\"点此按等级分排序\" onclick=\"location.href=location.search.replace(/&?order=[a-z]*/,\'\').replace(/\??/,\'?order=point&\').replace(/&+/,\'&\');\"><b>等级分︽').'</b></button></th>
      <th width=\"80\"><button type=\"button\" class=\"small\"'.($_GET['order'] == 'writecount' ? ' title=\"当前按发表主题数排序\" disabled=\"disabled\"><b style=\"color:#D8D8D8\">文章|回复︾' : ' title=\"点此按发表主题数排序\" onclick=\"location.href=location.search.replace(/&?order=[a-z]*/,\'\').replace(/\??/,\'?order=writecount&\').replace(/&+/,\'&\');\"><b>文章|回复︽').'</b></button></th>
      <th width=\"180\"><button type=\"button\" class=\"small\"'.($_GET['order'] == 'regdate' ? ' title=\"当前按注册时间排序\" disabled=\"disabled\"><b style=\"color:#D8D8D8\">注册时间︾</b>' : ' title=\"点此按注册时间排序\" onclick=\"location.href=location.search.replace(/&?order=[a-z]*/,\'\').replace(/\??/,\'?order=regdate&\').replace(/&+/,\'&\');\"><b>注册时间︽</b>').'</button></th>
      <th width=\"180\">最后访问</th>
      <th width=\"120\">QQ</th>
      <th width=\"35\">&nbsp;</th>
    </tr>
  </table>
</div>
"';
  $list_text = '"
<div class=\"li\">
  <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
    <tr>
      <td class=\"list_mode_logo\">".$user_pic."</td>
      <td style=\"text-align:left;\"><a class=\"li_a\" href=\"user.php?get=card&username=".urlencode($row["username"])."\" target=\"_blank\" title=\"点击查看发布人名片\"><b>".$row["username"]."</b></a> ".users_class($row["power"], $row["point"], $row["username"])."&nbsp;</td>
      <td width=\"80\" align=\"center\">".$row["point"]."&nbsp;</td>
      <td width=\"80\" align=\"center\">".($row["writecount"] > 0 ? "<a href=\"user.php?get=list&username=".urlencode($row["username"])."\" target=\"_blank\">".$row["writecount"]."</a>" : 0)."|".($row["replycount"] > 0 ? "<a href=\"user.php?get=reply&username=".urlencode($row["username"])."\" target=\"_blank\">".$row["replycount"]."</a>" : 0)."&nbsp;</td>
      <td width=\"180\" align=\"center\">".get_date_c($row["regdate"])."&nbsp;</td>
      <td width=\"180\" align=\"center\">".get_date_c($row["thisdate"])."&nbsp;</td>
	  <td width=\"120\" align=\"center\">".$row["qq"]."&nbsp;</td>
	  <td width=\"35\" align=\"center\"><a href=\"member.php?get=mess&username=".urlencode($row["username"])."\" target=\"_blank\" title=\"发短信\">写信</a></td>
    </tr>
  </table>
</div>
"';
  $r_ = 'username,power,point,writecount,replycount,regdate,qq,thisdate';

}



@ $_GET['username'] = trim($_GET['username']);

if ($_GET['username']) {
  $_GET['username'] = trim($_GET['username']);
  $_GET['username'] = str_replace('.', '&#46;', $_GET['username']);
  if (preg_match('/^([^\x00-\x7f]|\w|&#46;){3,45}$/', $_GET['username'])) {
    $eval = 'check_reg="'.$w_.'" AND username LIKE "%'.str_replace('_', '/_', $_GET['username']).'%" escape "/"';
    $search_r = '搜索结果 - ';
  } else {
    $eval = 'check_reg="'.$w_.'"';
    $search_r = '<span class="redword">用户名不合法</span> | ';
  }
} else {
  $eval = 'check_reg="'.$w_.'"';
}

@ require ('inc/function/get_page.php');
@ require ('inc/function/get_date.php');

$n = $mess = 0;
$text = '';

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

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

if ($n > 0) {
  $text .= eval('return '.$list_title_.';');
  $p = get_page($n); //页数
  $seek = $web['pagesize'] * ($p-1);
  $result = @mysql_query('SELECT '.$r_.' FROM `'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'` WHERE '.$eval.' ORDER BY '.$_GET['order'].' DESC LIMIT '.$seek.','.$web['pagesize'].'', $db);
  while ($row = @mysql_fetch_assoc($result)) {
    /*
    if ($row['username'] == $web['manager']) {
      continue;
    }
    */
    $user_pic = '<span class="iface_s"><a href="user.php?get=card&username='.urlencode($row['username']).'" target="_blank"><img src="obj.php?title=face-'.urlencode($row['username']).'.'.$web['img_up_format'].'" width="'.$web['img_w_s'].'" height="'.$web['img_h_s'].'" /></span>';

    $text .= eval('return '.$list_text.';');
    unset($row, $user_pic);
  }
  @mysql_free_result($result);

} else {
  $text = '<div class="text_err">暂无记录！</div>';
}

if (POWER >= 1) {
  $result = @mysql_query('SELECT mess_num FROM `'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'` WHERE username="'.$session[0].'" LIMIT 1', $db); //短信
  $row_member = @mysql_fetch_assoc($result);
  $mess = '<span class="area_statistics">'.preg_replace('/^\d+/', '<span>$0</span>', $row_member['mess_num']).'</span>';
  @mysql_free_result($result);
  unset($row_member);
}

@ require ('inc/function/add_online.php'); //在线

@mysql_close();

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $title; ?> - <?php echo $web['sitename2'], $web['code_author']; ?></title>
<link id="my_style" rel="stylesheet" type="text/css" href="inc/css/<?php echo $web['sitemode']; ?>/style.css">
<script language="javascript" src="inc/js/main.js" type="text/javascript"></script>
</head>
<body>
<div id="session" class="session">
<button type="button" onclick="window.open('write.php?mode=<?php echo $web['sitemode']; ?>','_blank');" title="发布文章"><b><div class="send_write"></div></b></button>
  <?php @ include ('inc/require/head.txt'); ?>
  &nbsp;
</div>
<?php
if ($web['siteclose'] > 1) {
  @include ('inc/require/siteclose_why.txt');
}
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" id="logo">
  <tr>
    <td width="200"><a href="<?php echo $web['path']; ?>"><img src="<?php echo $web['sitelogo']; ?>" /></a></td>
    <td align="right"><form id="searchform" action="?" method="get" title="搜索本类别成员" onsubmit="return $('keyword').value!=''||false;"><input name="username" id="keyword" class="large" type="text" /><input type="submit" name="submit" id="submit" class="search_member" value="" />
      <input name="act" type="hidden" value="<?php echo $_GET['act']; ?>" />
    </form>
    </td>
  </tr>
</table>
<div id="banner"> <a href="./">首页</a> <a href="list_company.php">商号</a> <a class="column_is">成员</a> <a href="list_online.php">在线</a> <a href="help.php">帮助</a>
  <?php @include ('inc/css/'.$web['sitemode'].'/banner.txt'); ?>
</div>
<div class="column">
  <h5>
    <a href="./">首页</a> &gt; 成员<?php echo @ $t_; ?></h5>
</div>
<div class="body">
  <div class="list_title">
    <?php echo @eval('return '.$list_title.';'); ?></div>
  <div class="body_in"><?php echo $text; ?>
<?php
echo @ get_page_foot($n, $web['pagesize'], $p, '?username='.$_GET['username'].'&act='.$_GET['act'].'&order='.$_GET['order'].'&p=');
?>
</div> </div>
<div id="foot">
  <?php @include ('inc/css/'.$web['sitemode'].'/foot.txt'); ?>
</div>
<script language="JavaScript" type="text/javascript">
<!--
try{$('new_mess').innerHTML='<?php echo $mess; ?>';}catch(err){}
-->
</script>

</body>
</html>