phpcms2008增加浏览次数插件代码_phpcms教程-查字典教程网
phpcms2008增加浏览次数插件代码
phpcms2008增加浏览次数插件代码
发布时间:2016-12-23 来源:查字典编辑
摘要:选择增加类型:指定ID:ID范围:-公司活跃指定ID:ID范围:-全部:栏目ID:全部点击重选重选functioncategory_load...

<?php

session_start();

extract($_POST);

require dirname(__FILE__).'/include/common.inc.php';

$keyadmin="www.bitefu.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>全部 <font color="red">点击重选</font></span>

<span id="reselect_catid">

<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>增加值不能为空!</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>输入信息有误请确认后再提交!</span>";

}

?>

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新phpcms学习
    热门phpcms学习
    CMS教程子分类