<?php 
include 'comm/conn.php';
include 'comm/config.php';
include 'comm/checkpostandget.php';
$kword=$_GET['keywords'];
$page = !($_GET['page'])?'1':intval($_GET['page']);
$page2=($page-1)*10;
$num1=10;

$link = mysql_connect($dbserver, $dbuser, $dbpass);
if (!$link) {
	die('数据库链接出错: ' . mysql_error());
}
else
{
	mysql_query("set names gbk");
	$sqll="select * from yf_article where yf_Name like '%".$kword."%' ";
	mysql_select_db($dbname);
	$rsl = mysql_query($sqll);
	$numb = mysql_num_rows($rsl);	
	
	$sqll="select * from yf_article where yf_Name like '%".$kword."%'  order by yf_ID desc limit $page2,$num1";
	//mysql_select_db($dbname);
	//echo $sql;
	$rsl = mysql_query($sqll);

}	

error_reporting(0);
require_once 'function.php';
$catid = !($_GET['catid'])?'0':intval($_GET['catid']);
$catid = getnochengrencid($catid);
$page = !($_GET['page'])?'0':intval($_GET['page']);
$sort = !($_GET['sort'])?'commissionNum_desc':$_GET['sort'];
$sp = !($_GET['sp']) ? '1' : $_GET['sp'];
$ep = !($_GET['ep']) ? '10000' : $_GET['ep'];

$cat_name = iconv("GBK","UTF-8","所有分类");
$is_parent = "false";
if($catid != 0)
{
	$Taoapi->method = 'taobao.itemcats.get';
	$Taoapi->fields = 'cid,name,parent_cid,is_parent';
	$Taoapi->cids = $catid;
	$TaoapiCat = $Taoapi->SendCheng('get','xml')->getArrayData();
	$result_cat = $TaoapiCat["item_cats"]["item_cat"];
	$cat_name = $result_cat["name"];
	$is_parent = $result_cat["is_parent"];
}

if($is_parent == "true")
{
	$Taoapi->method = 'taobao.itemcats.get';
	$Taoapi->fields = 'cid,name,parent_cid';
	$Taoapi->parent_cid = $catid;
	$TaoapiSubCats = $Taoapi->SendCheng('get','xml')->getArrayData();
	$result_subcats = $TaoapiSubCats["item_cats"]["item_cat"];
}

$Taoapi->method = 'taobao.taobaoke.items.get';
$Taoapi->fields = 'iid,num_iid,title,nick,pic_url,price,click_url,commission,commission_rate,commission_num,commission_volume,seller_credit_score,shop_click_url';
$Taoapi->nick = $usernick;
$Taoapi->cid = $catid;
$Taoapi->page_no = $page;
$Taoapi->page_size = '20';
$Taoapi->sort = $sort;
$Taoapi->start_price = $sp;
$Taoapi->end_price = $ep;
$TaoapiItems = $Taoapi->SendCheng('get','xml')->getArrayData();
$taobaokeItem = $TaoapiItems["taobaoke_items"]["taobaoke_item"];
$totalResults = $TaoapiItems["total_results"];

	mysql_query("set names gbk");
	$sql="select * from websetting where id=1";
	mysql_select_db($dbname);
	$rs = mysql_query($sql);
	while ($row = mysql_fetch_array($rs))
	{
		$appKey = $row[appKey];  
		$appSecret =$row[appSecret]; 
		$userpid = $row[userpid]; 
		$usernick = $row[usernick];
		$fxbl=$row[fxbl]; 
		$tgbl=$row[tgbl]; 
		
		$webtitle=$row[webtitle]; 
		$keyword=$row[keyword]; 
		$description=$row[description]; 
		$url=$row[url]; 
		$surl=$row[surl]; 
		$email=$row[email]; 
		$icp=$row[icp]; 
		$tongji=$row[tongji]; 
		$qq =$row[qq]; 
		$usercenter =$row[usercenter]; 
	}
?><!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=gb2312" />
<title>文章列表-<?php echo $webtitle ?></title>
<meta name="keywords" content="<?php echo $sitekey ?>" />
<meta name="description" content="<?php echo $sitedesc ?>" />
<link href="css/qqhk1.css" rel="stylesheet" type="text/css" />
<link href="images/default.css" rel="stylesheet" type="text/css">
<LINK href="/templets/beauty/alfs.css" type=text/css rel=stylesheet>
<LINK href="/templets/beauty/index_article.css" type=text/css rel=stylesheet>
</head>
<?php
include("header.php");
?>
<body>
<div id="main">
		<div class="plan" align="left">
			当前位置：<a href="<?php echo $url ?>">[<?php echo $webtitle ?>]</a>-[新闻中心] </div>
		<div class="box">
			<div id="left">
				<div class="diang border">
						<ul class="text"><?php echo $adshow14; ?>
					</ul>
				</div>
				<div class="diang border">
					<ul class="text"><?php echo $adshow15; ?>
					</ul>
				</div>
			</div>

				<div id="right">
				<div class="list">
					<div class="title2">
						<h4>[新闻中心]</h4>
						<ul>
							<li class="active"><a href="#" target="_self">发布时间 ↓</a></li>
						</ul>
					</div>
					<div class="cont">	
					  	  <table width="100%" border="0" cellspacing="5" cellpadding="0">
						  <?php
					while ($row = mysql_fetch_array($rsl))
					{ ?>
                          <tr>
                            <td width="79%" height="30"> <?php
                      	echo "&nbsp;<img src=img/new.gif></img><a href=yarticle-".$row[yf_ID].".htm target=_blank>".$row[yf_Name]."</a><br>";
					?></td>
                            <td width="21%"><?php
                      	echo "".$row[yf_AddTime]."";
					?><?php } ?></td>
                          </tr>
                      </table>
						 
						
						<div class="page pabg">
						  <div align="center">共<?php echo $numb;?>条新闻
	                    <?php  
require_once("comm/pages.php"); $page_size=10;    
  $nums=$numb;     
  $sub_pages=10;   
  $pageCurrent=$_GET["page"];     
     
  $subPages=new SubPages($page_size,$nums,$pageCurrent,$sub_pages,"artlist.php?keywords=".$kword."&page=",2);
?></div>
						</div>
					</div>
				</div>
			</div>
		</div>
</div>
<div align="center">
<?php
include("footer.php");
?>
</div>
</div>
</body>
</html>
<?php mysql_close($link);?>
