<?php 
	require_once('ls_admin/inc/conn.php');
	require_once('ls_admin/inc/constant.php');
	require_once('ls_admin/inc/ls_syscode.php');
	$opendb=new mydb();
	$sortdb=new mydb();
	require_once('ls_admin/inc/char_set.php');
?>
<!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>无标题文档</title>
</head>
<body>
<?php
$id = $_GET['id'];//获取传过的的id
if($id!="") 
{
		$news_cate_sql2="select * from ls_news where enable=1 and  ID=".$id."";//根据id查找新闻的现有的点击次数
		$result_cate=$opendb->query($news_cate_sql2);
		$num_cate=mysqli_fetch_array($result_cate);
		$hits= $num_cate['hits'];
		$hits=$hits+1;
		$updateSql="update ls_news set hits=".$hits." where ID=".$id."";//根据新闻id点击量累加
		$updateQuery=$sortdb->query($updateSql);
		
		$news_cate_sql="select * from ls_news where enable=1 and ID=".$id."  ";
		$result_cate1=$opendb->query($news_cate_sql);
		$num_cate1=mysqli_fetch_array($result_cate1);
		
		$click= $num_cate1['hits'];//返回留恋量值
		echo $click;
}
else
{
	$news_cate_sql2="select * from ls_news where enable=1 and ID=".$id."  ";
	$result_cate=$opendb->query($news_cate_sql2);
	$num_cate=mysqli_fetch_assoc($result_cate);
	echo $num_cate['hits'];
}
?>
</body>
</html>