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

/* 管理成员头像 */
/* 162100源码 - 162100.com */




@ require ('inc/set/set_userface.php');

$text = $err = $where_ev = $search_r = '';
$n = 0;
$_GET['username'] = @$_GET['username'];
if ($_GET['username']) {
  $search_r = '搜索结果 - ';
  $_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_ev = $_GET['username'].'.';
  } else {
    $search_r = '<span class="redword">用户名不合法</span> | ';
  }
}

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 title LIKE "face-'.$where_ev.'%"', $db);
  $row = @mysql_fetch_assoc($result);
  $n = abs($row['total']);
  @mysql_free_result($result);
  unset($row);

  if ($n > 0) {
    require ('inc/function/get_page.php');
    $p = get_page($n); //页数
    $seek = $web['pagesize'] * ($p-1);
    $result = @mysql_query('SELECT * FROM '.$sql['pref'].''.$sql['data']['承载上传数据的表名'].' WHERE title LIKE "face-'.$where_ev.'%" ORDER BY id DESC LIMIT '.$seek.','.$web['pagesize'].'', $db);
    while ($row = @mysql_fetch_assoc($result)) {
    $text .= '
<div class="li">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="20"><input name="id[]" id="id[]" type="checkbox" class="checkbox" value="'.$row['username'].'" /></td>
    <td style="text-align:left;">
    <a href="user.php?get=card&username='.urlencode($row['username']).'" target="_blank">'.$row['username'].'</a></td>
      <td width="100"><img src="obj.php?title=face-'.urlencode($row['username']).'.'.$web['img_up_format'].'" /></td>
      <td width="200">'.$row['type'].'</td>
      <td width="100">'.$row['date'].'</td>
    </tr>
  </table>
</div>
';

      unset($row);
    }
    @mysql_free_result($result);

    $text .= get_page_foot($n, $web['pagesize'], $p, '?get=member_userface&username='.$_GET['username'].'&p=');
  } else {
    $err = '头像记录为空';
  }


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


@mysql_close();
@clearstatcache();

?>
<div class="list_title"><a href="?get=member_userface" class="list_title_in"><?php echo $search_r; ?>成员头像列表<span>（<?php echo $n; ?>）</span></a><a href="?get=member">成员管理</a><a href="?get=member_company">商号管理</a></div>
<form method="post" id="manageform" name="manageform" action="?post=unity_run&dataname=member">
  
  <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_face')"><b>删除</b></button>
  <input type="checkbox" class="checkbox" name="delsendmess" id="delsendmess" value="1" />
    同时发信 <button name="button" type="button" onclick="addSubmitSafe();location.href='?post=unity_run&dataname=upload&limit=clear_face&id[]=1';"><b>一键全部清除</b></button> | 
  输入成员名<input name="username" id="usernamebox" value="<?php echo $_GET['username']; ?>" type="text" size="20" onkeydown="if(event.keyCode==13){location.href='?get=member_userface&username='+encodeURIComponent($('usernamebox').value)+'';return false;}" />
<button name="button" type="button" onclick="location.href='?get=member_userface&username='+encodeURIComponent($('usernamebox').value)+''"><b>搜索头像</b></button>
  </div>
  <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="100">上传时间</th>
      </tr>
    </table>
  </div>
  <?php
echo $text, $err;
?>
  <input type="hidden" name="limit" />
</form>
