ListAd.php 22.7 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548
<?php
define('EmpireCMSAdmin','1');
require("../../class/connect.php");
require("../../class/db_sql.php");
require("../../class/functions.php");
require "../".LoadLang("pub/fun.php");
$link=db_connect();
$empire=new mysqlquery();
$editor=1;
//驗證用戶
$lur=is_login();
$logininid=$lur['userid'];
$loginin=$lur['username'];
$loginrnd=$lur['rnd'];
$loginlevel=$lur['groupid'];
$loginadminstyleid=$lur['adminstyleid'];
//ehash
$ecms_hashur=hReturnEcmsHashStrAll();
//驗證權限
CheckLevel($logininid,$loginin,$classid,"ad");

//增加廣告
function AddAd($add,$titlefont,$titlecolor,$userid,$username){
	global $empire,$dbtbpre;
	if(!$add[classid]||!$add[title]||!$add[adtype])
	{printerror("EmptyAd","history.go(-1)");}
	//驗證權限
	CheckLevel($userid,$username,$classid,"ad");
	$add[htmlcode]=AddAddsData(RepPhpAspJspcodeText($add[htmlcode]));
	$add[reptext]=AddAddsData(RepPhpAspJspcodeText($add[reptext]));
	$ttitlefont=TitleFont($titlefont,'no');
	//變量處理
	$add['title']=hRepPostStr($add['title'],1);
	$add[pic_width]=(int)$add[pic_width];
	$add[pic_height]=(int)$add[pic_height];
	$add[classid]=(int)$add[classid];
	$add[adtype]=(int)$add[adtype];
	$add[t]=(int)$add[t];
	$add[ylink]=(int)$add[ylink];
	$add['filepass']=(int)$add['filepass'];
	$sql=$empire->query("insert into {$dbtbpre}enewsad(picurl,url,pic_width,pic_height,onclick,classid,adtype,title,target,alt,starttime,endtime,adsay,titlefont,titlecolor,htmlcode,t,ylink,reptext) values('$add[picurl]','$add[url]',$add[pic_width],$add[pic_height],0,$add[classid],$add[adtype],'$add[title]','$add[target]','$add[alt]','$add[starttime]','$add[endtime]','$add[adsay]','$ttitlefont','$titlecolor','$add[htmlcode]',$add[t],$add[ylink],'$add[reptext]');");
	$adid=$empire->lastid();
	//更新附件
	UpdateTheFileOther(3,$adid,$add['filepass'],'other');
	GetAdJs($adid);
	if($sql)
	{
		//操作日誌
		insert_dolog("adid=".$adid."<br>title=".$add[title]);
		printerror("AddAdSuccess","AddAd.php?enews=AddAd&t=".$add[t].hReturnEcmsHashStrHref2(0));
	}
	else
	{printerror("DbError","history.go(-1)");}
}

//修改廣告
function EditAd($add,$titlefont,$titlecolor,$userid,$username){
	global $empire,$time,$dbtbpre;
	$add[adid]=(int)$add[adid];
	if(!$add[classid]||!$add[title]||!$add[adtype]||!$add[adid])
	{printerror("EmptyAd","history.go(-1)");}
	//驗證權限
	CheckLevel($userid,$username,$classid,"ad");
	$add[htmlcode]=AddAddsData(RepPhpAspJspcodeText($add[htmlcode]));
	$add[reptext]=AddAddsData(RepPhpAspJspcodeText($add[reptext]));
	$ttitlefont=TitleFont($titlefont,'no');
	//重置
	if($add[reset])
	{$a=",onclick=0";}
	//變量處理
	$add['title']=hRepPostStr($add['title'],1);
	$add[pic_width]=(int)$add[pic_width];
	$add[pic_height]=(int)$add[pic_height];
	$add[classid]=(int)$add[classid];
	$add[adtype]=(int)$add[adtype];
	$add[t]=(int)$add[t];
	$add[ylink]=(int)$add[ylink];
	$add['filepass']=(int)$add['filepass'];
	$sql=$empire->query("update {$dbtbpre}enewsad set picurl='$add[picurl]',url='$add[url]',pic_width=$add[pic_width],pic_height=$add[pic_height],classid=$add[classid],adtype=$add[adtype],title='$add[title]',target='$add[target]',alt='$add[alt]',starttime='$add[starttime]',endtime='$add[endtime]',adsay='$add[adsay]',titlefont='$ttitlefont',titlecolor='$titlecolor',htmlcode='$add[htmlcode]',t=$add[t],ylink=$add[ylink],reptext='$add[reptext]'".$a." where adid='$add[adid]'");
	UpdateTheFileEditOther(3,$add['adid'],'other');
	GetAdJs($add[adid]);
	if($sql)
	{
		//操作日誌
		insert_dolog("adid=".$add[adid]."<br>title=".$add[title]);
		printerror("EditAdSuccess","ListAd.php?time=$time".hReturnEcmsHashStrHref2(0));
	}
	else
	{printerror("DbError","history.go(-1)");}
}

//刪除廣告
function DelAd($adid,$userid,$username){
	global $empire,$time,$public_r,$dbtbpre;
	$adid=(int)$adid;
	if(!$adid)
	{printerror("NotDelAdid","history.go(-1)");}
	//驗證權限
	CheckLevel($userid,$username,$classid,"ad");
	$r=$empire->fetch1("select title from {$dbtbpre}enewsad where adid='$adid'");
	$sql=$empire->query("delete from {$dbtbpre}enewsad where adid='$adid'");
	$file="../../../d/js/acmsd/".$public_r[adfile].$adid.".js";
	DelFiletext($file);
	//刪除附件
	DelFileOtherTable("modtype=3 and id='$adid'");
	if($sql)
	{
		//操作日誌
		insert_dolog("adid=".$adid."<br>title=".$r[title]);
		printerror("DelAdSuccess","ListAd.php?time=$time".hReturnEcmsHashStrHref2(0));
	}
	else
	{printerror("DbError","history.go(-1)");}
}

//批量生成廣告
function ReAdJs_all($start=0,$from,$userid,$username){
	global $empire,$public_r,$fun_r,$dbtbpre;
	$start=(int)$start;
	if(empty($start))
	{
		$start=0;
    }
	$b=0;
	$sql=$empire->query("select adid from {$dbtbpre}enewsad where adid>$start order by adid limit ".$public_r['readjsnum']);
	while($r=$empire->fetch($sql))
	{
		$b=1;
		$newstart=$r[adid];
		GetAdJs($r[adid]);
	}
	if(empty($b))
	{
		//操作日誌
		insert_dolog("");
		printerror("ReAdJsSuccess",$from);
	}
	echo $fun_r['OneReAdJsSuccess']."(ID:<font color=red><b>".$newstart."</b></font>)<script>self.location.href='ListAd.php?enews=ReAdJs_all&start=$newstart&from=".urlencode($from).hReturnEcmsHashStrHref(0)."';</script>";
	exit();
}

//清除註釋
function ClearHtmlZs($text){
	$text=str_replace('<!--','',$text);
	$text=str_replace('//-->','',$text);
	$text=str_replace('-->','',$text);
	return $text;
}

//生成廣告js
function GetAdJs($adid){
	global $empire,$public_r,$dbtbpre;
	$r=$empire->fetch1("select * from {$dbtbpre}enewsad where adid='$adid'");
	$file="../../../d/js/acmsd/".$public_r[adfile].$adid.".js";
	//到期
	if($r['endtime']<>'0000-00-00'&&time()>to_time($r['endtime']))
	{
		$r[reptext]=ClearHtmlZs($r[reptext]);
		$h=addslashes(str_replace("\r\n","",$r[reptext]));
		$html="document.write(\"".$h."\")";
		WriteFiletext_n($file,$html);
		return '';
	}
	if($r['ylink'])
	{
		$ad_url=$r['url'];
	}
	else
	{
		$ad_url=$public_r[newsurl]."e/public/ClickAd?adid=".$adid;//廣告鏈接
	}
	//----------------------文字廣告
	if($r[t]==1)
	{
		$r[titlefont]=$r[titlecolor].','.$r[titlefont];
		$picurl=DoTitleFont($r[titlefont],$r[picurl]);//文字屬性
		$h="<a href='".$ad_url."' target=".$r[target]." title='".$r[alt]."'>".addslashes($picurl)."</a>";
		//普通顯示
		if($r[adtype]==1)
		{
			$html="document.write(\"".$h."\")";
	    }
		//可移動透明對話框
		else
		{
			$html="document.write(\"<script language=javascript src=".$public_r[newsurl]."d/js/acmsd/ecms_dialog.js></script>\"); 
document.write(\"<div style='position:absolute;left:300px;top:150px;width:".$r[pic_width]."; height:".$r[pic_height].";z-index:1;solid;filter:alpha(opacity=90)' id=DGbanner5 onmousedown='down1(this)' onmousemove='move()' onmouseup='down=false'><table cellpadding=0 border=0 cellspacing=1 width=".$r[pic_width]." height=".$r[pic_height]." bgcolor=#000000><tr><td height=18 bgcolor=#5A8ACE align=right style='cursor:move;'><a href=# style='font-size: 9pt; color: #eeeeee; text-decoration: none' onClick=clase('DGbanner5') >關閉>>><img border='0' src='".$public_r[newsurl]."d/js/acmsd/close_o.gif'></a>&nbsp;</td></tr><tr><td bgcolor=f4f4f4 >&nbsp;".$h."</td></tr></table></div>\");";
	    }
    }
	//------------------html廣告
	elseif($r[t]==2)
	{
		$r[htmlcode]=ClearHtmlZs($r[htmlcode]);
		$h=addslashes(str_replace("\r\n","",$r[htmlcode]));
		//普通顯示
		if($r[adtype]==1)
		{
			$html="document.write(\"".$h."\")";
		}
		//可移動透明對話框
		else
		{
			$html="document.write(\"<script language=javascript src=".$public_r[newsurl]."d/js/acmsd/ecms_dialog.js></script>\"); 
document.write(\"<div style='position:absolute;left:300px;top:150px;width:".$r[pic_width]."; height:".$r[pic_height].";z-index:1;solid;filter:alpha(opacity=90)' id=DGbanner5 onmousedown='down1(this)' onmousemove='move()' onmouseup='down=false'><table cellpadding=0 border=0 cellspacing=1 width=".$r[pic_width]." height=".$r[pic_height]." bgcolor=#000000><tr><td height=18 bgcolor=#5A8ACE align=right style='cursor:move;'><a href=# style='font-size: 9pt; color: #eeeeee; text-decoration: none' onClick=clase('DGbanner5') >關閉>>><img border='0' src='".$public_r[newsurl]."d/js/acmsd/close_o.gif'></a>&nbsp;</td></tr><tr><td bgcolor=f4f4f4 >&nbsp;".$h."</td></tr></table></div>\");";
		}
    }
	//------------------彈出廣告
	elseif($r[t]==3)
	{
		//打開新窗口
		if($r[adtype]==8)
		{
			$html="window.open('".$r[url]."');";
		}
		//彈出窗口
	    elseif($r[adtype]==9)
		{
			$html="window.open('".$r[url]."','','width=".$r[pic_width].",height=".$r[pic_height].",scrollbars=yes');";
		}
		//普能網頁窗口
		else
		{
			$html="window.showModalDialog('".$r[url]."','','dialogWidth:".$r[pic_width]."px;dialogHeight:".$r[pic_height]."px;scroll:no;status:no;help:no');";
		}
    }
	//---------------------圖片與flash廣告
	else
	{
	$filetype=GetFiletype($r[picurl]);
	
	//flash
		if($filetype==".swf")
		{
		$h="<object classid=\\\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\\\" codebase=\\\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\\\" name=\\\"movie\\\" width=\\\"".$r[pic_width]."\\\" height=\\\"".$r[pic_height]."\\\" id=\\\"movie\\\"><param name=\\\"movie\\\" value=\\\"".$r[picurl]."\\\"><param name=\\\"quality\\\" value=\\\"high\\\"><param name=\\\"menu\\\" value=\\\"false\\\"><embed src=\\\"".$r[picurl]."\\\" width=\\\"".$r[pic_width]."\\\" height=\\\"".$r[pic_height]."\\\" quality=\\\"high\\\" pluginspage=\\\"http://www.macromedia.com/go/getflashplayer\\\" type=\\\"application/x-shockwave-flash\\\" id=\\\"movie\\\" name=\\\"movie\\\" menu=\\\"false\\\"></embed><PARAM NAME='wmode' VALUE='Opaque'></object>";
	    }
	else
		{
		$h="<a href='".$ad_url."' target=".$r[target]."><img src='".$r[picurl]."' border=0 width='".$r[pic_width]."' height='".$r[pic_height]."' alt='".$r[alt]."'></a>";
	    }
		//普通顯示
			if($r[adtype]==1)
		{
			$html="document.write(\"".$h."\");";
		}
		//滿屏浮動顯示
		elseif($r[adtype]==4)
		{
			$html="ns4=(document.layers)?true:false;
ie4=(document.all)?true:false;
if(ns4){document.write(\"<layer id=DGbanner2 width=".$r[pic_width]." height=".$r[pic_height]." onmouseover=stopme('DGbanner2') onmouseout=movechip('DGbanner2')>".$h."</layer>\");}
else{document.write(\"<div id=DGbanner2 style='position:absolute; width:".$r[pic_width]."px; height:".$r[pic_height]."px; z-index:9; filter: Alpha(Opacity=90)' onmouseover=stopme('DGbanner2') onmouseout=movechip('DGbanner2')>".$h."</div>\");}
document.write(\"<script language=javascript src=".$public_r[newsurl]."d/js/acmsd/ecms_float_fullscreen.js></script>\");";
		}
		//上下浮動顯示 - 右
		elseif($r[adtype]==5)
		{
			$html="if (navigator.appName == 'Netscape')
{document.write(\"<layer id=DGbanner3 top=150 width=".$r[pic_width]." height=".$r[pic_height].">".$h."</layer>\");}
else{document.write(\"<div id=DGbanner3 style='position: absolute;width:".$r[pic_height].";top:150;visibility: visible;z-index: 1'>".$h."</div>\");}
document.write(\"<script language=javascript src=".$public_r[newsurl]."d/js/acmsd/ecms_float_upanddown.js></script>\");";
		}
		//上下浮動顯示 - 左
		elseif($r[adtype]==6)
		{
			$html="if(navigator.appName == 'Netscape')
{document.write(\"<layer id=DGbanner10 top=150 width=".$r[pic_width]." height=".$r[pic_height].">".$h."</layer>\");}
else{document.write(\"<div id=DGbanner10 style='position: absolute;width:".$r[pic_width].";top:150;visibility: visible;z-index: 1'>".$h."</div>\");}
document.write(\"<script language=javascript src=".$public_r[newsurl]."d/js/acmsd/ecms_float_upanddown_L.js></script>\");";
		}
		//全屏幕漸隱消失
		elseif($r[adtype]==7)
		{
			$html="ns4=(document.layers)?true:false;
if(ns4){document.write(\"<layer id=DGbanner4Cont onLoad='moveToAbsolute(layer1.pageX-160,layer1.pageY);clip.height=".$r[pic_height].";clip.width=".$r[pic_width]."; visibility=show;'><layer id=DGbanner4News position:absolute; top:0; left:0>".$h."</layer></layer>\");}
else{document.write(\"<div id=DGbanner4 style='position:absolute;top:0; left:0;'><div id=DGbanner4Cont style='position:absolute;width:".$r[pic_width].";height:".$r[pic_height].";clip:rect(0,".$r[pic_width].",".$r[pic_height].",0)'><div id=DGbanner4News style='position:absolute;top:0;left:0;right:820'>".$h."</div></div></div>\");} 
document.write(\"<script language=javascript src=".$public_r[newsurl]."d/js/acmsd/ecms_fullscreen.js></script>\");";
		}
		//可移動透明對話框
		elseif($r[adtype]==3)
		{
			$html="document.write(\"<script language=javascript src=".$public_r[newsurl]."d/js/acmsd/ecms_dialog.js></script>\"); 
document.write(\"<div style='position:absolute;left:300px;top:150px;width:".$r[pic_width]."; height:".$r[pic_height].";z-index:1;solid;filter:alpha(opacity=90)' id=DGbanner5 onmousedown='down1(this)' onmousemove='move()' onmouseup='down=false'><table cellpadding=0 border=0 cellspacing=1 width=".$r[pic_width]." height=".$r[pic_height]." bgcolor=#000000><tr><td height=18 bgcolor=#5A8ACE align=right style='cursor:move;'><a href=# style='font-size: 9pt; color: #eeeeee; text-decoration: none' onClick=clase('DGbanner5') >關閉>>><img border='0' src='".$public_r[newsurl]."d/js/acmsd/close_o.gif'></a>&nbsp;</td></tr><tr><td bgcolor=f4f4f4 >&nbsp;".$h."</td></tr></table></div>\");";
		}
		else
		{
			$html="function closeAd(){huashuolayer2.style.visibility='hidden';huashuolayer3.style.visibility='hidden';}function winload(){huashuolayer2.style.top=109;huashuolayer2.style.left=5;huashuolayer3.style.top=109;huashuolayer3.style.right=5;}//if(document.body.offsetWidth>800){
				{document.write(\"<div id=huashuolayer2 style='position: absolute;visibility:visible;z-index:1'><table width=0  border=0 cellspacing=0 cellpadding=0><tr><td height=10 align=right bgcolor=666666><a href=javascript:closeAd()><img src=".$public_r[newsurl]."d/js/acmsd/close.gif width=12 height=10 border=0></a></td></tr><tr><td>".$h."</td></tr></table></div>\"+\"<div id=huashuolayer3 style='position: absolute;visibility:visible;z-index:1'><table width=0  border=0 cellspacing=0 cellpadding=0><tr><td height=10 align=right bgcolor=666666><a href=javascript:closeAd()><img src=".$public_r[newsurl]."d/js/acmsd/close.gif width=12 height=10 border=0></a></td></tr><tr><td>".$h."</td></tr></table></div>\");}winload()//}";
		}
    }
	WriteFiletext_n($file,$html);
}

$enews=$_POST['enews'];
if(empty($enews))
{$enews=$_GET['enews'];}
if($enews)
{
	hCheckEcmsRHash();
}
//增加廣告
if($enews=="AddAd")
{
	$add=$_POST['add'];
	$add[picurl]=$_POST['picurl'];
	$titlefont=$_POST['titlefont'];
	$titlecolor=$_POST['titlecolor'];
	$add['filepass']=$_POST['filepass'];
	AddAd($add,$titlefont,$titlecolor,$logininid,$loginin);
}
//修改廣告
elseif($enews=="EditAd")
{
	$add=$_POST['add'];
	$add[picurl]=$_POST['picurl'];
	$titlefont=$_POST['titlefont'];
	$titlecolor=$_POST['titlecolor'];
	$time=$_POST['time'];
	$add['filepass']=$_POST['filepass'];
	EditAd($add,$titlefont,$titlecolor,$logininid,$loginin);
}
//刪除廣告
elseif($enews=="DelAd")
{
	$adid=$_GET['adid'];
	$time=$_POST['time'];
	DelAd($adid,$logininid,$loginin);
}
//批量刷新廣告JS
elseif($enews=="ReAdJs_all")
{
	ReAdJs_all($_GET['start'],$_GET['from'],$logininid,$loginin);
}

$page=(int)$_GET['page'];
$page=RepPIntvar($page);
$start=0;
$line=20;//每頁顯示條數
$page_line=12;//每頁顯示鏈接數
$offset=$page*$line;//總偏移量
$totalquery="select count(*) as total from {$dbtbpre}enewsad";
$query="select * from {$dbtbpre}enewsad";
//過期廣告
$search='';
$search.=$ecms_hashur['ehref'];
$where='';
$and='';
$time=(int)$_GET['time'];
if($time)
{
	$date=date("Y-m-d");
	$where.="endtime<'$date' and endtime<>'0000-00-00'";
	$and=' and ';
	$search.="&time=$time";
}
//搜索
$sear=(int)$_GET['sear'];
if($sear)
{
	$keyboard=RepPostVar2($_GET['keyboard']);
	$show=(int)$_GET['show'];
	$classid=(int)$_GET['classid'];
	$t=(int)$_GET['t'];
	if($keyboard)
	{
		if($show==1)
		{
			$where.=$and."title like '%$keyboard%'";
		}
		elseif($show==2)
		{
			$where.=$and."adsay like '%$keyboard%'";
		}
		else
		{
			$where.=$and."(title like '%$keyboard%' or adsay like '%$keyboard%')";
		}
		$and=' and ';
	}
	if($classid)
	{
		$where.=$and."classid='$classid'";
		$and=' and ';
	}
	if($t!=9)
	{
		$where.=$and."t='$t'";
		$and=' and ';
	}
	$search.="&classid=$classid&show=$show&t=$t&sear=1&keyboard=$keyboard";
}
if($where)
{
	$totalquery.=' where '.$where;
	$query.=' where '.$where;
}
$num=$empire->gettotal($totalquery);//取得總條數
$query=$query." order by adid desc limit $offset,$line";
$sql=$empire->query($query);
$returnpage=page2($num,$line,$page_line,$start,$page,$search);
$ty[1]="普通顯示";
$ty[2]="";
$ty[3]="可移動透明對話框";
$ty[4]="滿屏浮動顯示";
$ty[5]="上下浮動顯示 - 右";
$ty[6]="上下浮動顯示 - 左";
$ty[7]="全屏幕漸隱消失";
$ty[8]="打開新窗口";
$ty[9]="彈出窗口";
$ty[10]="普通網頁對話框";
$ty[11]="對聯式廣告";
$myt[1]="文字廣告";
$myt[2]="html廣告";
$myt[3]="彈出廣告";
$myt[0]="圖片與flash廣告";
//廣告類別
$csql=$empire->query("select classid,classname from {$dbtbpre}enewsadclass");
while($cr=$empire->fetch($csql))
{
	$cselected='';
	if($classid==$cr['classid'])
	{
		$cselected=' selected';
	}
	$options.="<option value=".$cr[classid].$cselected.">".$cr[classname]."</option>";
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
<title>管理廣告</title>
<script>
function eCopyAdStr(adid,isjs){
	var str='';
	if(isjs==1)
	{
		str='<scri'+'pt src="<?=$public_r[newsurl]?>d/js/acmsd/<?=$public_r[adfile]?>'+adid+'.js"></scri'+'pt>';
	}
	else
	{
		str='[phomead]'+adid+'[/phomead]';
	}
	window.clipboardData.setData('Text',str);
}
</script>
</head>

<body>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
  <tr> 
    <td width="20%" height="25">位置:<a href="ListAd.php<?=$ecms_hashur['whehref']?>">管理廣告</a></td>
    <td width="80%"><div align="right" class="emenubutton">
        <input type="button" name="Submit5" value="增加廣告" onclick="self.location.href='AddAd.php?enews=AddAd<?=$ecms_hashur['ehref']?>';">&nbsp;&nbsp;
        <input type="button" name="Submit52" value="管理過期廣告" onclick="self.location.href='ListAd.php?time=1<?=$ecms_hashur['ehref']?>';">&nbsp;&nbsp;
        <input type="button" name="Submit522" value="管理廣告分類" onclick="self.location.href='AdClass.php<?=$ecms_hashur['whehref']?>';">
      </div></td>
  </tr>
</table>
<form name="form1" method="get" action="ListAd.php">
  <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
			<?=$ecms_hashur['eform']?>
    <tr> 
      <td height="25" bgcolor="#FFFFFF">關鍵字: 
        <input name="keyboard" type="text" id="keyboard" value="<?=$keyboard?>">
        <select name="show">
		<option value="0"<?=$show==0?' selected':''?>>不限</option>
		<option value="1"<?=$show==1?' selected':''?>>廣告名稱 </option>
		<option value="2"<?=$show==2?' selected':''?>>備註</option>
        </select>
        <select name="classid" id="classid">
          <option value="0">不限類別</option>
          <?=$options?>
        </select> <select name="t" id="t">
          <option value="9"<?=$sear&&$t==9?' selected':''?>>不限廣告類型</option>
          <option value="0"<?=$sear&&$t==0?' selected':''?>>圖片與flash廣告</option>
          <option value="1"<?=$sear&&$t==1?' selected':''?>>文字廣告</option>
          <option value="2"<?=$sear&&$t==2?' selected':''?>>html廣告</option>
          <option value="3"<?=$sear&&$t==3?' selected':''?>>彈出廣告</option>
        </select>
        <input name="time" type="checkbox" id="time" value="1"<?=$time==1?' checked':''?>>
        過期廣告 
        <input type="submit" name="Submit" value="搜索"> <input name="sear" type="hidden" id="sear" value="1"></td>
    </tr>
  </table>
</form>
<table width="100%" border="0" cellspacing="1" cellpadding="3" class="tableborder">
  <tr class="header"> 
    <td width="4%" height="25"><div align="center">ID</div></td>
    <td width="20%"><div align="center">廣告名稱</div></td>
    <td width="11%"><div align="center">廣告類型</div></td>
    <td width="7%"><div align="center">過期時間</div></td>
    <td width="18%"><div align="center">JS調用</div></td>
    <td width="5%"><div align="center">點擊</div></td>
    <td width="18%"><div align="center">備註</div></td>
    <td width="17%"><div align="center">操作</div></td>
  </tr>
  <?
  while($r=$empire->fetch($sql))
  {
  ?>
  <tr bgcolor="#FFFFFF" onmouseout="this.style.backgroundColor='#ffffff'" onmouseover="this.style.backgroundColor='#C3EFFF'"> 
    <td height="25"> <div align="center"> 
        <?=$r[adid]?>
      </div></td>
    <td> <div align="center"> 
        <b><?=$r[title]?></b>
      </div></td>
    <td> <div align="center"> 
        <?=$myt[$r[t]]?>
        <br>
        (<?=$ty[$r[adtype]]?>)</div></td>
    <td> <div align="center"> 
        <?=$r[endtime]?>
      </div></td>
    <td> <div align="center"> 
        <input name="textfield" type="text" value="<?=$public_r[newsurl]?>d/js/acmsd/<?=$public_r['adfile']?><?=$r[adid]?>.js" size="26">
        <br>
        <a href="#ecms" onclick="eCopyAdStr(<?=$r[adid]?>,1);" title="點擊複製JS調用代碼">JS調用</a> | <a href="#ecms" onclick="eCopyAdStr(<?=$r[adid]?>,0);" title="點擊複製標籤調用代碼">標籤調用</a><br>
      </div></td>
    <td> <div align="center"> 
        <?=$r[onclick]?>
      </div></td>
    <td> <div align="center"> 
        <textarea name="textarea" cols="20" rows="3"><?=$r[adsay]?></textarea>
      </div></td>
    <td> <div align="center"><a href="../view/js.php?js=<?=$public_r['adfile']?><?=$r[adid]?>&p=acmsd<?=$ecms_hashur['ehref']?>" target="_blank">預覽</a> | <a href="AddAd.php?enews=EditAd&adid=<?=$r[adid]?>&time=<?=$time?><?=$ecms_hashur['ehref']?>">修改</a> | <a href="ListAd.php?enews=DelAd&adid=<?=$r[adid]?>&time=<?=$time?><?=$ecms_hashur['href']?>" onclick="return confirm('確認要刪除?');">刪除</a></div></td>
  </tr>
  <?
  }
  ?>
  <tr bgcolor="#FFFFFF"> 
    <td height="25" colspan="8"> 
      <?=$returnpage?>
    </td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="3">
  <tr>
    <td height="25"><font color="#666666">說明:調用方式:&lt;script src=廣告js地址&gt;&lt;/script&gt;或用標籤調用</font></td>
  </tr>
</table>
</body>
</html>
<?
db_close();
$empire=null;
?>