<?php
/*
'**************************************************************************************************
' 软件名称: 盘锦DJ舞曲网CMS Content Management PjRen.Net
' 版本编号: Version 2.5
' 盘锦舞曲: http://www.pj57.com
' 官方网站: http://www.pjren.net
' 小说网站: http://www.hx39.com
' 0427DJ网: http://www.0427dj.net
' 官方论坛: http://www.tianjiazhen.com
' 版权所有: 盘锦舞曲开发团队    盘锦人(QQ:814006710)
' 郑重声明:
'    1、任何个人或组织不得在未经授权的情况下删除、修改、拷贝本软件及其他副本上一切关于版权的信息；
'    2、盘锦网络事业部保留此软件的法律追究权利
'**************************************************************************************************
*/
header("Content-type: text/html;charset=gb2312");
include "../include/conn.php";
include "../include/function.php";
$adid=SafeRequest("adid","get","zr");
$types=SafeRequest("types","get","zr");
if(!IsNum($adid) or !IsNum($types)){
	die("document.write(\"出错了，广告代码错误\");");
	}
if($types==0){
	$cache_id ="single_".$adid;
	if(!($cache_opt->start($cache_id))){
		$sql="select S_TheAdrJs,S_IsUse from  s_adsense where S_ID=".$adid." ";
		$row=$db->getrow($sql);
		if($row){
			if($row['S_IsUse']==1){
				echo "document.write('您好，广告未开启!')";
				}
			else{
				echo ''.$row['S_TheAdrJs'].'';
				}				
			}
		else{
				echo "document.write(\"出错了，广告代码错误！\")";
			}
		$cache_opt->end();
	}	
	
	}
elseif($types==1){
	$cache_id ="group_".$adid;
	if(!($cache_opt->start($cache_id))){
		$sql="select S_TheAdrJs from s_adsense where S_GroupID=".$adid."";
		$result=$db->getAll($sql);
		if(count($result)==0){
			die("document.write(\"对不起，广告组没有广告！\")");
			}
		else{
			$showid=mt_rand(0,(count($result)-1));
			echo ''.$result[$showid]['S_TheAdrJs'].'';
			}	
	$cache_opt->end();
	}
}	
?>