首 页 ASP ASP.NET PHP JSP Ajax DIV+CSS JavaScript XML C#
MySQL MSSQL Access Oracle Linux Server 电脑技巧 网络安全 建站经验 其它

随机广告显示(PHP函数)

整理日期:2007年06月14日 【字体:


伊图教程网[www.etoow.com]
http://www.etoow.com/html/2007-06/1181852389.html

#####播放广告代码#########
$num=0;
$flag=0;

for($i=0;$i<$lines;$i++){
if((!strcmp(substr($ads_lines[$i],0,7),"display"))){$num++;}
if(($num==$ads_num)and($flag==0)){$flag=1;continue;}
if(($flag==1)and strcmp($ads_lines[$i][0],"#")){echo $ads_lines[$i];continue;}
if(($flag==1)and(!(strcmp($ads_lines[$i][0],"#")))){break;}
}
####纪录广告显示次数#########
$fp=fopen($log,"a");
fputs($fp,date( "Y-m-d H:i:s " ).getenv("REMOTE_ADDR")."==>".$ads_num." ");
fclose($fp);
}
?>

广告代码文件ads.txt

########每个广告代码之间用'#'隔开,display为显示加权数,越大显示次数越多########
display=10

<a href="http://www.etoow.com">
<img src="ad.gif" alt="www.etoow.com"> </a>
################################
display=10

<a href="http://www.fcx.net" target="_blank">
<img src="http://www.fcxx.net/ad.gif" width="468" height="60" alt="www.fcxx.net" border="0"></a>


调用<?php myads();?>即可
Tags:
随机广告显示(PHP函数)
'http://www.etoow.com/html/2007-06/1181852389.html
1
 
信息搜索
  
联系我们关于本站广告服务设为首页 收藏本站友情链接网站地图
Copyright © Etoow.com Inc. All Rights Reserved