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

/* 取：用户回复 */
/* 162100源码 - 162100.com */


$_GET['username'] = strtolower(trim($_GET['username']));
$_GET['username'] = str_replace('.', '&#46;', $_GET['username']);
$text=$err = '';
if (!preg_match('/^([^\x00-\x7f]|\w|&#46;){3,45}$/', $_GET['username'])) :
  $err .= '用户名不合法！';
else :

  $n = 0;

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

  if ($sql['db_err'] == '') {
    $result = @mysql_query('SELECT username,replycount,check_reg FROM `'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'` WHERE username="'.$_GET['username'].'" LIMIT 1', $db);
    if (!$row = @mysql_fetch_assoc($result)) {
      $err = '查不到用户'.$_GET['username'].'的信息！';
	} else {
      $replycount = $row['replycount'];
      if ($row['check_reg'] == '1') {
        $err = '用户'.$_GET['username'].'尚在注册审核中！';
      }
      if ($row['check_reg'] == '2') {
        $err = '用户'.$_GET['username'].'已经被置入黑名单！';
      }
      unset($row);
    }
    @mysql_free_result($result);

    if (empty($err)) {

      $article_url_base = $web['url_html_article'] == 1 ? '"article.".$area_mode[get_arearoot($row["area_id"])].".".$row["r_id"].".1.html' : '"article.php?mode=".$area_mode[get_arearoot($row["area_id"])]."&id=".$row["r_id"]."';
    $result = @mysql_query('SELECT area_id,area_check_reply,area_index FROM '.$sql['pref'].''.$sql['data']['承载版区分类的表名'].' WHERE area_id REGEXP "^[0-9]+\-[0-9]+$"', $db);
    while ($row = @mysql_fetch_assoc($result)) {
      $area_mode[$row['area_id']] = get_li_mode($row['area_index']);
      unset($row);
    }
    @mysql_free_result($result);


      $result = @mysql_query('SELECT COUNT(id) AS total FROM `'.$sql['pref'].''.$sql['data']['承载回复评论的表名'].'` WHERE author_ip="'.$_GET['username'].'" AND area_check_reply="0"', $db);
      $row = @mysql_fetch_assoc($result);
      $n = abs($row['total']);
      @mysql_free_result($result);
      unset($row);

      require('inc/function/get_page.php');
    require ('inc/function/cutstr.php');
      if ($n > 0) {
        $p = get_page($n); //页数
        $seek = $web['pagesize'] * ($p-1);

        $result = @mysql_query('SELECT A.id,A.r_id,A.text,A.date,A.area_check_reply,A.reward,B.area_id,B.author_ip,B.title,B.date AS d FROM '.$sql['pref'].''.$sql['data']['承载回复评论的表名'].' AS A,'.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' AS B WHERE A.author_ip="'.$_GET['username'].'" AND area_check_reply="0" AND B.id=A.r_id ORDER BY id DESC LIMIT '.$seek.','.$web['pagesize'].'', $db);

        while ($row = @mysql_fetch_assoc($result)) {
          $text .= '
<table width="100%" class="li" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="20"><input name="id[]" id="id[]" type="checkbox" class="checkbox" value="'.$row['id'].'" /></td>
    <td>

  <div><span class="column_">于'.$row['author_ip'].' '.$row['d'].'发表的主题<a href="'.eval('return '.$article_url_base.'";').'" target="_blank"><b>《'.$row['title'].'》</b></a>中</span></div>
  <div class="text">'.cutstr($row['text'], 450).'</div>
  <div class="li_">
    回复时间('.$row['date'].') '.($row['reward']>0?'<span class="red_err">此回复获得悬赏'.$row['reward'].'</span> ':'').'<a href="'.eval('return '.$article_url_base.'&reply_id='.$row['id'].'#reply_'.$row['id'].'";').'" target="_blank">查看回复详情&raquo;</a>
  </div>

    </td>
  </tr>
</table>
';

        }
        @mysql_free_result($result);
        $text .= get_page_foot($n, $web['pagesize'], $p, '?get=reply&username='.urlencode($_GET['username']).'&p=');

	  } else {
        $err = '数据为空！该用户尚未发表或已被删除。';
	  }
    }

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

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

endif;


echo '<div class="list_title"><a href="?get=list&username='.urlencode($_GET['username']).'">文章记录</a><a class="list_title_in">回复记录<span>（<span title="实际库存">'.$n.'</span>/<span title="总计" class="grayword">'.$replycount.'</span>）</span></a></div>';
?>
<style type="text/css">
<!--
.li .column_ { border-bottom:1px #999966 solid; }
-->
</style>
<form method="post" id="manageform" action="member.php?post=unity_run&dataname=myaccount">
<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;
    <button name="act" type="button" onclick="chk(this.form,this,'collect_reply')"><b>加入“我的收藏”</b></button>
</div>
<?php

echo $text, $err;

?>
<input type="hidden" name="limit" />

</form>
