<?php
include_once("../inc/config.php");
include_once("../inc/publicfun.php");
include_once("../inc/ftbbsdbclass.php");
include_once("../pageclass.php");
include_once("../conn.php");
include_once("check_master.php");

$id=trim($_POST["id"]);
$xzms=trim($_POST["xzms"]);
$xzimg=trim($_POST["xzimg"]);
$add=trim($_POST["add"]);

if ($xzms!="" && $xzimg!=""){
   if ($add!="ok"){
   $sql="update {$tablepre}xunzhang set xzms='".$xzms."',xzimg='".$xzimg."' where id=".$id;
   mysql_query($sql);
   }
   else{
   $sql="insert into {$tablepre}xunzhang (xzms,xzimg) values('$xzms','$xzimg')";
   mysql_query($sql);
   }
}

$str="select * from {$tablepre}xunzhang order by id asc";
$rs=mysql_query($str);
$myrow = mysql_fetch_array($rs);
$numrows = mysql_num_rows($rs);
?>
<html>
<head>
<title>勋章管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="../css/main01.css" rel="stylesheet" type="text/css">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<table width="99%" border="0" bgcolor="#f1f1f1" cellspacing="1" cellpadding="0" align="center">
  <tr bgcolor="#f3f3f3" align="center" class="f12"> 
    <td height="25" colspan="2" bgcolor="#f3f3f3"><strong>勋章管理</strong></td>
  </tr>
  <tr bgcolor="#FFFFFF" align="center" class="f12"> 
    <td height="25">序号</td>
    <td width="96%" height="25"> <div align="left">勋章说明与图片(勋章图片一定要放在images目录下)</div></td>
  </tr>
<?
if ($numrows!=0){
$i=1;
do {		  
?>
  <tr bgcolor="#FFFFFF" align="center" class="f12"> 
    <form name="form1" method="post" action="">
      <td width="4%" height="25"><?=$i?></td>
      <td align="left"> 勋章说明
<input name="xzms" type="text" id="xzms" value="<?=$myrow["xzms"]?>" size="50" maxlength="50">
        勋章图标
<input name="xzimg" type="text" id="xzimg" value="<?=$myrow["xzimg"]?>" size="30" maxlength="20"> 
        <input type="submit" name="Submit" value="修改" <? if (false===strrpos($_SESSION["admin_qs"],"2")){?>disabled<? }?>> 
        <input name="id" type="hidden" id="id" value="<?=$myrow["id"]?>">
        <a href="delxz.php?id=<?=$myrow["id"]?>">删除</a></td>
    </form>
  </tr>
<?
$i++;
}
while ($myrow = mysql_fetch_array($rs));
}
?>
   <tr bgcolor="#FFFFFF" align="center" class="f12"> 
    <form name="form1" method="post" action="">
      <td width="4%" height="40">&nbsp;</td>
      <td align="left"> 勋章说明
<input name="xzms" type="text" id="xzms" size="50" maxlength="50">
        勋章图标
<input name="xzimg" type="text" id="xzimg" size="30" maxlength="20"> 
        <input type="submit" name="Submit" value="添加" <? if (false===strrpos($_SESSION["admin_qs"],"1")){?>disabled<? }?>>
        <input name="add" type="hidden" id="add" value="ok"> </td>
    </form>
  </tr>
  <tr align=center bgcolor="#F3F3F3" class="f12"> 
    <td height="28" colspan="12" align="left"></td>
  </tr>
</table>
</body>
</html>