phpcms2008增加浏览次数插件代码

乐清SEO_开发应用_PHPCMS_ 乐清SEO2021-01-19 转载自:

代码如下:


<?php 
session_start(); 
extract($_POST); 
require dirname(__FILE__).'/include/common.inc.php'; 
$keyadmin="www.aspku.net"; 
if($key && $key==$keyadmin) 

$_SESSION["NowKey"]=$keyadmin; 

if($_SESSION["NowKey"] && $_SESSION["NowKey"]=$keyadmin){ 
?> 
<script language="JavaScript" src="images/js/jquery.min.js"></script> 
<form action="" method="post" name="form"> 
选择增加类型:

<hr> 
指定ID: 
<input name="thisid" type="text" id="thisid" size="10" /> 

ID范围: 
<input name="idstart" type="text" id="idstart" size="10" /> 

<input name="idend" type="text" id="idend" size="10" /> 
<hr /> 
公司活跃
指定ID: 
<input name="comid" type="text" id="comid" size="10" /> 
ID范围: 
<input name="comstart" type="text" id="comstart" size="10" /> 

<input name="comend" type="text" id="comend" size="10" /> 
全部: 
<input name="comall" type="checkbox" id="comall" value="1" /> 
<hr /> 
栏目ID: 
<input type="hidden" name="catid" id="catid" value="all"> 
<span onclick="this.style.display='none';$('#reselect_catid').show();" style="cursor:pointer;">全部 <font color="red">点击重选</font></span> 
<span id="reselect_catid" style="display:none;"> 
<span id="load_catid"></span> 
<a href="javascript:category_reload();">重选</a> 
</span><script type="text/javascript"> 
function category_load(id) 

$.get('load.php', { field: 'catid', id: id }, 
function(data){ 
$('#load_catid').append(data); 
}); 

function category_reload() 

$('#load_catid').html(''); 
category_load(0); 

category_load(0); 
</script> 
<hr> 

增加值:<input name="addnum" type="text" size="10" value="<?=$addnum;?>"/>【必填】 

<input type="submit" name="submit" value="提交" /> 
</form> 
<?php 
}else{ 
?> 
<form id="form1" name="form1" method="post" action=""> 
KEY:<input type="text" name="key" /> 
<input type="submit" name="checkkey" value="提交" /> 
</form> 
<? }?> 
<?php 
//print_r($_POST); 
if(!$addnum && $submit){echo "<span style='color:red'>增加值不能为空!</span>";} 
if($submit && $addnum) 

if($thisid){ 
$sql="update `".DB_PRE."content_count` set `hits` = `hits` + ".$addnum." where `contentid`='$thisid'"; 
}else if($idstart){ 
$sql="update `".DB_PRE."content_count` set `hits` = `hits` + ".$addnum." where `contentid` >= '$idstart'"; 
if($idend){$sql.=" and `contentid` <= '$idend'";} 
}else if($comid || $comstart || $comall){ 
if($comid){ 
$sql="update `".DB_PRE."member_info` set `logintimes` = `logintimes` + ".$addnum." where `userid`='$comid'"; 
}else if($comstart){ 
$sql="update `".DB_PRE."member_info` set `logintimes` = `logintimes` + ".$addnum." where `userid` >= '$comstart'"; 
if($comend){$sql.=" and `userid` <='$comend'";} 
}else if($comall && $comall==1){ 
$sql="update `".DB_PRE."member_info` set `logintimes` = `logintimes` + ".$addnum; 
}else{$sql='';} 
}else if($catid){// 
if($catid=="all"){ 
$sql="update `".DB_PRE."content_count` set `hits` = `hits` + ".$addnum; 
}else{ 
$getid_query=mysql_query("select `contentid` from `".DB_PRE."content` where status=99 ".get_sql_catid($catid)); 
while($rs=mysql_fetch_assoc($getid_query)){$getid[]=$rs['contentid'];} 
$idstr=implode(",",$getid); 
$sql="update `".DB_PRE."content_count` set `hits` = `hits` + ".$addnum." where `contentid` in ($idstr)"; 

}else{$sql='';} 

if($sql && $submit) 

mysql_query($sql); 
echo date("Y-m-d H:i:s")."成功执行了添加操作,共影响数据: ".mysql_affected_rows()." 条"; 
}else if(!$sql && $submit){ 
echo "
<span style='color:red'>输入信息有误请确认后再提交!</span>"; 

?>