<?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("../admin/check_master.php");

$id=intval($_GET["clubuser_id"]);
$act=trim($_POST["act"]);
if ($act=="y"){
  $idList=$_POST["checkbox1"];
  for($i=0; $i<count($idList); $i++){
  $clubuser_zip=$clubuser_zip.$idList[$i].",";
  }
  $clubuser_zip=substr($clubuser_zip,0,strlen($clubuser_zip)-1);
  mysql_query("update {$tablepre}clubuser set clubuser_zip='".$clubuser_zip."' where clubuser_id='".$id."'");
}
$str="select clubuser_zip from {$tablepre}clubuser where clubuser_id='".$id."'";
$rs=mysql_query($str);
$row = mysql_fetch_array($rs);
$numrows = mysql_num_rows($rs);
$clubuser_zip=$row["clubuser_zip"];
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>勋章授予</title>
<link href="../css/main01.css" rel="stylesheet" type="text/css">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<table width="100%" border="0" align="center" cellpadding=2 cellspacing=1 class="listborder">
  <form name="form1" method="post" action="">
    <tr class="f14"> 
      <td height="28" colspan="2" class="f12bg">用户勋章授予</td>
    </tr>
    <tr> 
      <td width="87%" height="25" valign="middle" class="loopborder2"> &nbsp;&nbsp;&nbsp;&nbsp;描述</td>
      <td width="13%" valign="middle" class="loopborder2"><div align="center">图片</div></td>
    </tr>
<?
$sql="select * from {$tablepre}xunzhang order by id asc";
$rs=mysql_query($sql);
$myrow = mysql_fetch_array($rs);
$numrows = mysql_num_rows($rs);
do {
?>
    <tr> 
      <td height="50" valign="middle" class="loopborder2"> <input name="checkbox1[]" type="checkbox" value="<?=$myrow["xzimg"]?>" <? if (false!==strrpos($clubuser_zip,$myrow["xzimg"])){?>checked<? }?>><?=$myrow["xzms"]?></td>
      <td valign="middle" class="loopborder2"><div align="center"><img src="../images/<?=$myrow["xzimg"]?>" width="20" height="35"></div></td>
    </tr>
<?
}
while ($myrow = mysql_fetch_array($rs));
?>
    <tr> 
      <td height="40" colspan="2"> <div align="center"> 
          <input type="submit" name="Submit" value="提交">
          <input name="act" type="hidden" id="act" value="y">
        </div></td>
    </tr>
  </form>
</table>
</body>
</html>