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

/* 取：用户文章 */
/* 162100源码 - 162100.com */


$_GET['username'] = strtolower(trim($_GET['username']));
$_GET['username'] = str_replace('.', '&#46;', $_GET['username']);
$text=$err = '';
$list_url = $web['url_html_list'] == 1 ? '"list.".$area_mode[get_arearoot($row["area_id"])].".".$row["area_id"]."..1.html"' : '"list.php?mode=".$area_mode[get_arearoot($row["area_id"])]."&area_id=".$row["area_id"].""';
      $article_url = $web['url_html_article'] == 1 ? '"article.".$area_mode[get_arearoot($row["area_id"])].".".$row["id"].".1.html"' : '"article.php?mode=".$area_mode[get_arearoot($row["area_id"])]."&id=".$row["id"].""';
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,writecount,check_reg FROM `'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'` WHERE username="'.$_GET['username'].'" LIMIT 1', $db);
    if (!$row = @mysql_fetch_assoc($result)) {
      $err = '查不到用户'.$_GET['username'].'的信息！';
	} else {
      $writecount = $row['writecount'];
      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)) {
      $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="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/get_date.php'); //时间
      if ($n > 0) {
        $p = get_page($n); //页数
        $seek = $web['pagesize'] * ($p-1);

        $result = @mysql_query('SELECT *,(topdate-DATE_ADD(UTC_TIMESTAMP(), INTERVAL '.floatval($web['time_pos']).' HOUR)) AS t FROM `'.$sql['pref'].''.$sql['data']['承载主题文章的表名'].'` WHERE author_ip="'.$_GET['username'].'" AND area_check="0" ORDER BY topdate DESC LIMIT '.$seek.','.$web['pagesize'].'', $db);
        while ($row = @mysql_fetch_assoc($result)) {
          //$row['title'] = preg_replace('/(\|.*)?/', '', $row['title']);
          $area_postion[$row['area_id']][] = $row['id'];

          $text .= '
<table width="100%" class="li_face" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="20"><input name="id[]" id="id[]" type="checkbox" class="checkbox" value="'.$row['id'].'" /></td>
    <td class="li_subject">
      '.$row['title_mark'].'<a href="'.eval('return '.$article_url.';').'" title="'.$row['title'].'" class="li_a" target="_blank"'.$row['title_style'].'>'.$row['title'].'</a> <span class="ar" id="area_name_'.$row['id'].'"></span>
        <div class="li_"> 
	    发表（'.get_date_c($row['date']).'）
        <span class="li_update_mark" title="更新"></span>（'.get_date_c($row['topdate']).'）
        </div>
      </td>
        <td class="li_views_reply">回复/阅览<br />'.$row['reply'].'/'.$row['views'].'</td>
  </tr>
</table>
';
        }
        @mysql_free_result($result);
        $text .= get_page_foot($n, $web['pagesize'], $p, '?get=list&username='.urlencode($_GET['username']).'&p=');

	  } else {
        $err = '数据为空！该用户尚未发表或已被删除。';
	  }
    }
    $result = @mysql_query('SELECT area_id,area_name FROM '.$sql['pref'].''.$sql['data']['承载版区分类的表名'].' WHERE area_id="'.@implode('" OR area_id="', array_keys($area_postion)).'"', $db);
    if (@mysql_num_rows($result) > 0) {
      while ($row = @mysql_fetch_assoc($result)) {
        foreach ((array)$area_postion[$row['area_id']] as $v) {
          $text .= '<script>$("area_name_'.$v.'").innerHTML="[…/<a href=\"'.eval('return '.$list_url.';').'\" target=\"_blank\">'.addslashes($row['area_name']).'</a>]";</script>';
        }
        unset($row);
      }
    }
    @mysql_free_result($result);


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

  require ('inc/function/add_online.php'); //在线
  $sql['sql_version'] = @mysql_get_server_info();
  @mysql_close();

endif;


echo '<div class="list_title"><a class="list_title_in">文章记录<span>（<span title="实际库存">'.$n.'</span>/<span title="总计" class="grayword">'.$writecount.'</span>）</span></a><a href="?get=reply&username='.urlencode($_GET['username']).'">回复记录</a></div>';
?>
<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_listdata')"><b>加入“我的收藏”</b></button>
</div>
<?php
if (isset($sql['sql_version']) && $sql['sql_version'] < '5.0') {
  echo '<div class="red_err">服务器数据库版本（'.$sql['sql_version'].'）太低！数据可能显示不正常。本程序建设基于MySQL版本5.0以上</div>';
}

echo $text, $err;

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

</form>
