dedecms ajax 下载统计代码
<?php
require_once (dirname(__FILE__) . "/include/common.inc.php");
require_once(DEDEINC."/channelunit.class.php");
$aid = (isset($aid) && is_numeric($aid)) ? $aid : 0;
$rand =mt_rand(10,80);
$query = "select count(*) as dd from #@__downloads where id='$aid'";
$row = $dsql->GetOne($query);
if($row['dd'] > 0)
{
$query = "update #@__downloads set downloads=downloads+$rand where id='$aid'";
$dsql->ExecNoneQuery($query);
}else {
$query = "insert into #@__downloads(hash,id,downloads) values('null$aid','$aid',1)";
$dsql->ExecNoneQuery($query);
}
下面是实例方法。
<!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" />
<script src="http://pstatic.xunlei.com/js/webThunderDetect.js"></script>
<script src="http://pstatic.xunlei.com/js/base64.js"></script>
<script language="javascript" type="text/javascript">
var xmlHttp = false;
function ajaxcreate(){
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e2) {
xmlHttp = false;
}
}
if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
xmlHttp = new XMLHttpRequest();
}
if(!xmlHttp){alert('Create Xmlhttp Fail ');return false;}
}
function ajax_add(){
ajaxcreate();
var url="/ajax_down.php?aid="+encodeURI(5396)+"&rd="+Math.random();
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlHttp.send(null);
}
</script>
<title>绿色版Apache+Php+Mysql V1.3 自动安装版_下载地址列表_网站源码下载-整站源码下载-站长常用工具下载</title>
<link href="/templets/style/search.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<div class="header">
<div class="toplogo">
<h1><a href="http://down.111cn.net/">网站源码下载-整站源码下载-站长常用工具下载</a></h1>
</div>
</div>
<div class="msgbar">
<p>
<strong>软件名称:<a href='/down/soft/server/2009/0629/5396.html'>绿色版Apache+Php+Mysql V1.3 自动安装版</a></strong>
</p>
</div>
<div class="advancedsearch">
<table width="100%" border="0" align="center" cellspacing="2">
<tr>
<td height="30" bgcolor="#F2F7E6">下载地址列表:</td>
</tr>
<tr>
<td height="78"><script language="javascript" src="/js/gg_bottom.js"></script>
<a href="#" class="red" thunderHref="thunder://QUFodHRwOi8vemp0ZWxlNC5za3ljbi5jb20vZG93bi9nZ2dBUE1zZXJ2ZXIuemlwWlo=" thunderPid="85957" thunderType="" thunderResTitle="" onClick="ajax_add();return OnDownloadClick_Simple(this,2);" oncontextmenu="ThunderNetwork_SetHref(this)" >[迅雷专用下载]</a>
<script type="text/javascript"><!--
google_ad_client = "pub-6219414158063594";
/* 336x280, 创建于 09-3-29 */
google_ad_slot = "8019903307";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<script type="text/javascript"><!--
google_ad_client = "pub-6219414158063594";
google_ad_format = "configurable_sdo";
google_link_target = 2;
google_color_bg = "ffffff";
google_color_link = "000000";
google_color_text = "000000";
google_encoding = "GB2312";
google_ad_channel = "5161927073";
google_box_len = 40;
google_logo_pos = "left";
google_rs_pos = "below";
google_ad_height = 65;
google_ad_width = 500;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_sdo.js">
</script>
</td>
</tr>
</table>
</div>
<div class="footer">
<p class="link">
网站版权信息及免责声明
</p>
<p class="powered">
Copyright <a href="http://down.111cn.net" title="" target="_blank"><strong>down.<span>111cn.net</span></strong></a> © 2004-2008 Inc.
<script language="javascript" src="/js/count.js"></script>
</p><!-- /powered -->
</div>
<div id="tt" ></div>
</body>
</html>
<!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>无标题文档</title>
</head>
<body>
<?php
$content =file_get_contents('http://down.111cn.net/');
if( !empty( $content ) ){
$info = fopen('down.txt','w+');
fwrite($info,$content);
fclose($info);
print_r(file('down.txt') );
}
?>
</body>
</html>
文章为各位提供一个哦,如果喜欢就行了。
<?php
if(!defined('DEDEINC'))
{
exit("Request Error!");
}
function SpHtml2Text($str)
{
$str = preg_replace("/<sty(.*)\/style>|<scr(.*)\/script>|<!--(.*)-->/isU","",$str);
$alltext = "";
$start = 1;
for($i=0;$i<strlen($str);$i++)
{
if($start==0 && $str[$i]==">")
{
$start = 1;
}
else if($start==1)
{
if($str[$i]=="<")
{
$start = 0;
$alltext .= " ";
}
else if(ord($str[$i])>31)
{
$alltext .= $str[$i];
}
}
}
$alltext = str_replace(" "," ",$alltext);
$alltext = preg_replace("/&([^;&]*)(;|&)/","",$alltext);
$alltext = preg_replace("/[ ]+/s"," ",$alltext);
return $alltext;
}
?>
php 字符截取与图片过滤函数本文章免费为各位朋友提供一款哦,如果你喜欢的话不防进来看看这款图片过滤正则表达试
function msubstr($str, $start, $len) {
$tmpstr = "";
$strlen = $start + $len;
for($i = 0; $i < $strlen; $i++) {
if(ord(substr($str, $i, 1)) > 0xa0) {
$tmpstr .= substr($str, $i, 2);
$i++;
} else
$tmpstr .= substr($str, $i, 1);
}
return $tmpstr;
}
//过滤图片
function img_empty($content){
$content=eregi_replace("<IMG ([a-zA-Z0-9~!& ?:"/._#=~&%]+)>","",$content);
return $content;
}
function getvis(&$pagesid,&$retime) {
global $err,$conf,$HTTP_COOKIE_VARS,$_COOKIE;
if(isset($_COOKIE['ant'])) $cot=$_COOKIE['ant'];
elseif(isset($HTTP_COOKIE_VARS['ant'])) $cot=$HTTP_COOKIE_VARS['ant'];
else $cot='';
$cos=preg_split("/x/",$cot);
$max=sizeof($cos);
for($c=0;$c<$max;$c++) {
if(strlen($cos[$c])==10) {
$id=substr($cos[$c],0,2);
eval("$id=0x$id;");
$anct[$id]=$cos[$c];
}
}
if(isset($_COOKIE['anm'])) $com=$_COOKIE['anm'];
elseif(isset($HTTP_COOKIE_VARS['anm'])) $com=$HTTP_COOKIE_VARS['anm'];
else $com='';
$cos=preg_split("/x/",$com);
$max=sizeof($cos);
for($c=0;$c<$max;$c++) {
if(strlen($cos[$c])==10) {
$id=substr($cos[$c],0,2);
eval("$id=0x$id;");
$tim=substr($cos[$c],2,8);
eval("$tim=0x$tim;");
if($tim>=$conf->mtime) $ancm[$id]=$cos[$c];
}
}
if(isset($_COOKIE['anw'])) $cow=$_COOKIE['anw'];
elseif(isset($HTTP_COOKIE_VARS['anw'])) $cow=$HTTP_COOKIE_VARS['anw'];
else $cow='';
$cos=preg_split("/x/",$cow);
$max=sizeof($cos);
for($c=0;$c<$max;$c++) {
if(strlen($cos[$c])==10) {
$id=substr($cos[$c],0,2);
eval("$id=0x$id;");
$tim=substr($cos[$c],2,8);
eval("$tim=0x$tim;");
if($tim>=$conf->wtime) $ancw[$id]=$cos[$c];
}
}
if(isset($_COOKIE['an1'])) $co1=$_COOKIE['an1'];
elseif(isset($HTTP_COOKIE_VARS['an1'])) $co1=$HTTP_COOKIE_VARS['an1'];
else $co1='';
$cos=preg_split("/x/",$co1);
$max=sizeof($cos);
for($c=0;$c<$max;$c++) {
if(strlen($cos[$c])==10) {
$id=substr($cos[$c],0,2);
eval("$id=0x$id;");
$tim=substr($cos[$c],2,8);
eval("$tim=0x$tim;");
if($tim>=$conf->dtime) $anc1[$id]=$cos[$c];
}
}
//current time in HEX
if($conf->ctime>0x7FFFFFFF) {
$t1=$conf->ctime/16;
$t2=$conf->ctime&0xF;
$ctimestr=sprintf("%07X%01X",$t1,$t2);
}
else {
$ctimestr=sprintf("%08X",$conf->ctime);
}
reset($pagesid);
while($e=each($pagesid)) {
$k=$e[0];
if(isset($anct[$k])) {
$pagesid[$k].='|0';
if(strlen($anct[$k])==10) {
$tim=substr($anct[$k],2,8);
eval("$tim=0x$tim;");
$retime[$k]=$tim;
}
}
else {
$pagesid[$k].='|1';
$anct[$k]=sprintf("%02X%s",$k,$ctimestr);
}
if(isset($ancm[$k])) $pagesid[$k].='|0';
else {
$pagesid[$k].='|1';
$ancm[$k]=sprintf("%02X%s",$k,$ctimestr);
}
if(isset($ancw[$k])) $pagesid[$k].='|0';
else {
$pagesid[$k].='|1';
$ancw[$k]=sprintf("%02X%s",$k,$ctimestr);
}
if(isset($anc1[$k])) $pagesid[$k].='|0';
else {
$pagesid[$k].='|1';
$anc1[$k]=sprintf("%02X%s",$k,$ctimestr);
}
}
$cot=join('x',$anct);
$com=join('x',$ancm);
$cow=join('x',$ancw);
$co1=join('x',$anc1);
//get path
$path=$conf->url;
$path=preg_replace("/^(http://)([^/]+)/i",'',$path);
$path.='aa.php';
//set cookie
SetCookie('ant',$cot,time()+($conf->time1*3000),$path);
SetCookie('anm',$com,time()+($conf->time1*31),$path);
SetCookie('anw',$cow,time()+($conf->time1*7),$path);
SetCookie('an1',$co1,time()+$conf->time1,$path);
}
相关文章
- 有一种方法,可以不打开网站而直接查看到这个网站的源代码.. 这样可以有效地防止误入恶意网站... 在浏览器地址栏输入: view-source:http://...2016-09-20
- <?php require('path.inc.php'); header('content-Type: text/html; charset=utf-8'); $borough_id = intval($_GET['id']); if(!$borough_id){ echo ' ...2016-11-25
- 这篇文章主要介绍了C#实现HTTP下载文件的方法,包括了HTTP通信的创建、本地文件的写入等,非常具有实用价值,需要的朋友可以参考下...2020-06-25
- 本文实例讲述了JS基于Mootools实现的个性菜单效果代码。分享给大家供大家参考,具体如下:这里演示基于Mootools做的带动画的垂直型菜单,是一个初学者写的,用来学习Mootools的使用有帮助,下载时请注意要将外部引用的mootools...2015-10-23
- 本文实例讲述了JS+CSS实现分类动态选择及移动功能效果代码。分享给大家供大家参考,具体如下:这是一个类似选项卡功能的选择插件,与普通的TAb区别是加入了动画效果,多用于商品类网站,用作商品分类功能,不过其它网站也可以用,...2015-10-21
- 本文实例讲述了JS实现自定义简单网页软键盘效果。分享给大家供大家参考,具体如下:这是一款自定义的简单点的网页软键盘,没有使用任何控件,仅是为了练习JavaScript编写水平,安全性方面没有过多考虑,有顾虑的可以不用,目的是学...2015-11-08
- php 取除连续空格与换行代码,这些我们都用到str_replace与正则函数 第一种: $content=str_replace("n","",$content); echo $content; 第二种: $content=preg_replac...2016-11-25
- php简单用户登陆程序代码 这些教程很对初学者来讲是很有用的哦,这款就下面这一点点代码了哦。 <center> <p> </p> <p> </p> <form name="form1...2016-11-25
- 公司一些wordpress网站由于下载的插件存在恶意代码,导致整个服务器所有网站PHP文件都存在恶意代码,就写了个简单的脚本清除。恶意代码示例...2015-10-23
- 本文实例讲述了JS实现双击屏幕滚动效果代码。分享给大家供大家参考,具体如下:这里演示双击滚屏效果代码的实现方法,不知道有觉得有用处的没,现在网上还有很多还在用这个特效的呢,代码分享给大家吧。运行效果截图如下:在线演...2015-10-30
- 其实挺简单的就是if(navigator.userAgent.indexOf('UCBrowser') > -1) {alert("uc浏览器");}else{//不是uc浏览器执行的操作}如果想测试某个浏览器的特征可以通过如下方法获取JS获取浏览器信息 浏览器代码名称:navigator...2015-11-08
- 一、日期减去天数等于第二个日期function cc(dd,dadd){//可以加上错误处理var a = new Date(dd)a = a.valueOf()a = a - dadd * 24 * 60 * 60 * 1000a = new Date(a)alert(a.getFullYear() + "年" + (a.getMonth() +...2015-11-08
- 举一个案例:复制代码 代码如下:<?phpclass Downfile { function downserver($file_name){$file_path = "./img/".$file_name;//转码,文件名转为gb2312解决中文乱码$file_name = iconv("utf-8","gb2312",$file_name...2014-06-07
- 微信支付,即便交了保证金,你还是处理测试阶段,不能正式发布。必须到你通过程序测试提交订单、发货通知等数据到微信的系统中,才能申请发布。然后,因为在微信中是通过JS方式调用API,必须在微信后台设置支付授权目录,而且要到...2014-05-31
- 本文实例讲述了PHP常用的小程序代码段。分享给大家供大家参考,具体如下:1.计算两个时间的相差几天$startdate=strtotime("2009-12-09");$enddate=strtotime("2009-12-05");上面的php时间日期函数strtotime已经把字符串...2015-11-24
- 小编分享了一段简单的php中文转拼音的实现代码,代码简单易懂,适合初学php的同学参考学习。 代码如下 复制代码 <?phpfunction Pinyin($_String...2017-07-06
- 这篇文章主要为大家详细介绍了Visual Studio 2015下载和安装图文教程,具有一定的参考价值,感兴趣的小伙伴们可以参考一下...2021-09-22
php导出csv格式数据并将数字转换成文本的思路以及代码分享
php导出csv格式数据实现:先定义一个字符串 存储内容,例如 $exportdata = '规则111,规则222,审222,规222,服2222,规则1,规则2,规则3,匹配字符,设置时间,有效期'."/n";然后对需要保存csv的数组进行foreach循环,例如复制代...2014-06-07- ecshop商品无限级分类代码 function cat_options($spec_cat_id, $arr) { static $cat_options = array(); if (isset($cat_options[$spec_cat_id]))...2016-11-25
- 本文介绍了如何延迟javascript代码的加载,加快网页的访问速度。 当一个网站有很多js代码要加载,js代码放置的位置在一定程度上将会影像网页的加载速度,为了让我们的网页加载速度更快,本文总结了一下几个注意点...2013-10-13