<?php
require_once('session.php');
require_once('../fun/funsql.php'); 
require_once('../fun/funlogic.php');
if (isset($_GET["rel"])){$rel=$_GET["rel"];}else{$rel="";}
?>
<!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=utf-8" />
<title> Home</title>
<link href="css_body.css" rel="stylesheet" type="text/css" />
</head>
<script type="text/javascript" src="../fun/adminjs.js"></script>
<body>
<?php if($rel==''){?>
<div class='bodytitle'><div class='bodytitleleft'></div><div class='bodytitletxt'>广告管理</div></div>
<table width="96%" border="0" cellpadding="0" cellspacing="0" align="center" style="margin-bottom:8px;display:block" id="td1" >
<tr> 
<td>
<table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#E2F5BC" class="sysinfo">
<tr align="center"> 
<td  height="25" bgcolor="#FFFFFF" align="left">ID</td>
<td bgcolor="#FFFFFF" align="left">名称</td>
<td bgcolor="#FFFFFF" align="left">标识</td>
<td bgcolor="#FFFFFF" align="left">时间</td>
<td bgcolor="#FFFFFF" align="left">管理</td>
</tr>
<?php 
$sql=query("select * from ".$dbz."ad order by id asc");
while($row=fetch($sql)){
?>
<td  height="25" bgcolor="#FFFFFF" align="left"><?php echo $row["id"]; ?></td>
<td bgcolor="#FFFFFF" align="left"><?php echo $row["names"]; ?></td>
<td bgcolor="#FFFFFF" align="left">{[c9:global ad=<?php echo $row["tags"]; ?>]}</td>
<td bgcolor="#FFFFFF" align="left"><?php echo $row["times"]; ?></td>
<td bgcolor="#FFFFFF" align="left"><a href="ad.php?rel=ad_info&id=<?php echo $row["id"]; ?>">修改</a> <a href="query.php?rel=ad_del&id=<?php echo $row["id"]; ?>">删除</a></td>
</tr>
<?php }?>
</table>
<table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#E2F5BC" class="sysinfo">
</table>
</td>
</tr>
</table>
<?php }?>
<?php if($rel=='ad_add'){?>
<div class='bodytitle'><div class='bodytitleleft'></div><div class='bodytitletxt'>广告添加</div></div>
<table width="96%" border="0" cellpadding="0" cellspacing="0" 
	align="center" style="margin-bottom:8px;display:block" id="td1" >
<tr> 
<td>
<form id="form1" name="form1" method="post" action="query.php?rel=ad_add">
<table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#E2F5BC" class="sysinfo">
<tr align="center"> 
<td width="20%" height="25" bgcolor="#FFFFFF">变量说明</td>
<td bgcolor="#FFFFFF">变量值</td>
<td width="30%" bgcolor="#FFFFFF">介绍</td>
</tr>  
<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 广告名称:</td>
<td align="left" bgcolor="#FFFFFF">
<input type='text' name='names' value='' style='width:60%' maxlength="20"></td>
<td align="left" bgcolor="#FFFFFF">主要描述广告,没有实际意义</td>
</tr>
<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 广告标识:</td>
<td align="left" bgcolor="#FFFFFF">
<input type='text' name='tags' value='' style='width:60%' maxlength="50"></td>
<td align="left" bgcolor="#FFFFFF">风格调用时使用,标签不得重复</td>
</tr>
<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 广告代码:</td>
<td align="left" bgcolor="#FFFFFF">
<textarea name="codes" rows="5" cols="50"></textarea></td>
<td align="left" bgcolor="#FFFFFF">广告代码</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#E2F5BC" class="sysinfo">
<tr align="center" height="24">
  <td height="30" colspan="3" align="left" bgcolor="#EDF9D5"><b>&nbsp;请按照说明设置.</b></td>
  </tr>
<tr align="center" height="24">
  <td height="30" colspan="3" align="center" bgcolor="#FFFFFF"><input type="submit" name="Submit" value="确定" /> 
    <input type="reset" name="Submit2" value="重置" /></td>
  </tr>
</table>
</form>
</td>
</tr>
</table>
<?php }?>
<?php if($rel=='ad_info'){
$id=funstr($_GET["id"]);
$sql=query("select * from ".$dbz."ad where id=$id");
if($row=fetch($sql)){
$codes=str_replace("\\","",$row["codes"]);
?>
<div class='bodytitle'><div class='bodytitleleft'></div><div class='bodytitletxt'>广告修改</div></div>
<table width="96%" border="0" cellpadding="0" cellspacing="0" 
	align="center" style="margin-bottom:8px;display:block" id="td1" >
<tr> 
<td>
<form id="form1" name="form1" method="post" action="query.php?rel=ad_info">
<table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#E2F5BC" class="sysinfo">
<tr align="center"> 
<td width="20%" height="25" bgcolor="#FFFFFF">变量说明</td>
<td bgcolor="#FFFFFF">变量值</td>
<td width="30%" bgcolor="#FFFFFF">介绍</td>
</tr>  
<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 广告名称:</td>
<td align="left" bgcolor="#FFFFFF">
<input type='text' name='names' value='<?php echo $row["names"] ?>' style='width:60%' maxlength="20"></td>
<td align="left" bgcolor="#FFFFFF">主要描述广告,没有实际意义</td>
</tr>
<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 广告标识:</td>
<td align="left" bgcolor="#FFFFFF">
<input type='text' name='tags' value='<?php echo $row["tags"] ?>' style='width:60%' maxlength="50"></td>
<td align="left" bgcolor="#FFFFFF">风格调用时使用,标签不得重复</td>
</tr>
<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 广告代码:</td>
<td align="left" bgcolor="#FFFFFF">
<textarea name="codes" rows="5" cols="50"><?php echo $codes ?></textarea></td>
<td align="left" bgcolor="#FFFFFF">广告代码</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#E2F5BC" class="sysinfo">
<tr align="center" height="24">
  <td height="30" colspan="3" align="left" bgcolor="#EDF9D5"><b>&nbsp;请按照说明设置.</b></td>
  </tr>
<tr align="center" height="24">
  <td height="30" colspan="3" align="center" bgcolor="#FFFFFF">
  <input type="hidden" name="id" value="<?php echo $row["id"] ?>" />
  <input type="submit" name="Submit" value="确定" /> 
    <input type="reset" name="Submit2" value="重置" /></td>
  </tr>
</table>
</form>
</td>
</tr>
</table>
<?php }}?>
<?php mysql_close();?>

</body>
</html>