<?php

/* 商号列表 */
/* 162100源码 - 162100.com - download.162100.com */

$title = '商号';

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

//处理关键字
function process_input() {
  $str = preg_replace('/[[:punct:]]/i', ' ', $_GET['keyword']);
  $str = preg_replace('/\pP/u', ' ', $str);
  $str=trim($str);
  //$str=str_replace(' ','|',$str);
  return $str;
}

if (isset($_GET['keyword']) && $_GET['keyword'] != '') {
  $keyword = process_input();
  $search_r = '搜索结果 - ';
  $whole_eval = 'company LIKE "%'.$keyword.'%"';

} else {
  $whole_eval = 'company<>""';

}


@ 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 check_reg="0" AND '.$whole_eval.'',$db);
$row = @mysql_fetch_assoc($result);
$n = abs($row['total']);
@mysql_free_result($result);
unset($row);

if ($n > 0) {
  $p = get_page($n); //页数
  $seek = $web['pagesize'] * ($p-1);
  $result = @mysql_query('SELECT username,company,regdate,sign FROM `'.$sql['pref'].''.$sql['data']['承载成员档案的表名'].'` WHERE check_reg="0" AND '.$whole_eval.' ORDER BY id DESC LIMIT '.$seek.','.$web['pagesize'].'', $db);
  while ($row = @mysql_fetch_assoc($result)) {
    $hurl = preg_replace('/^http:\/\//i', '', $row['sign']);
	$row['username'] = preg_replace('/&#46;/', '.', $row['username']);
	
    $text .= '
<div class="li">
<a class="li_a" href="user.php?get=company&username='.urlencode($row['username']).'" target="_blank">'.$row['company'].'</a>
<div class="li_"><a href="user.php?get=card&username='.urlencode($row['username']).'" target="_blank" title="点击查看商号名片">商号名片（<img src="inc/images/card.gif" />）</a>
	网址（'.(!empty($hurl) ? '<a href="http://'.$hurl.'" target="_blank">'.$hurl.'</a>' : '未登记').'）
	登记时间（'.get_date_c($row['regdate']).'）
</div>
</div>
';
    unset($row);
  }
  @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('member.php?get=file#my_company','_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 width="455"><form action="?action=search" method="get" onsubmit="return $('keyword').value!=''||false;"><input style="width:350px; color:#999999;" class="large" type="text" id="keyword" name="keyword" onfocus="if(this.value=='关键词'){this.value=''}" value="关键词" /> <button class="large" type="submit" id="submit" name="submit"><b>搜索商号</b></button>
        <input type="hidden" name="action" value="search" />
      </form></td>
    <td align="right"><button class="large" type="button" onclick="window.open('member.php?get=file#my_company','_blank');"><b><div class="send_write">免费登记商号</div></b></button></td>
  </tr>
</table>
<div id="banner"> <a href="./">首页</a> <a class="column_is">商号</a> <a href="list_member.php">成员</a> <a href="list_online.php">在线</a> <a href="help.php">帮助</a>
  <?php @include ('inc/css/'.$web['sitemode'].'/banner.txt'); ?>
</div>
<?php @include ('inc/css/'.$web['sitemode'].'/ad_top.txt'); ?>
<div class="column">
  <h5><a href="./">首页</a> &gt; 已登记的商号</h5>
</div>
<table border="0" cellpadding="0" cellspacing="0" class="body">
  <tr valign="top">
  <td class="left">
    <div class="body">
      <div class="list_title"><a class="list_title_in"><?php echo @ $search_r; ?>商号记录<span>（<?php echo $n; ?>）</span></a><a href="<?php echo $web['url_html_list'] == 1 ? 'list.'.$web['sitemode'].'...1.html' : 'list.php?mode='.$web['sitemode'].''; ?>">信息记录</a></div>
      <div class="body_in">
        <?php echo $text; ?>
      <?php echo @ get_page_foot($n, $web['pagesize'], $p, '?keyword='.urlencode($_GET['keyword']).'&p='); ?><?php @include ('inc/css/'.$web['sitemode'].'/ad_article_text_bottom.txt'); ?>
      </div>
    </div>
  </td>
  <td class="right">
    <div class="hot">
      <div class="title">热门标签</div><div class="text">
      <?php
      @include ('inc/require/hot_mark.txt');
	  ?>
    </div></div>
    <div class="ad_side">
    <?php @include ('inc/css/'.$web['sitemode'].'/ad_article_side.txt'); ?></div>
  </td>
  </tr>
</table>
<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>