<?php session_start();include("conn/conn.php");
if($_SESSION[tb_user]==true){
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>投票系统</title>
<style type="text/css">
<!--
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
.style2 {font-size: 12px}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.style11 {	font-size: 13px;
	font-weight: bold;
}
body,td,th {
	font-size: 12px;
}
-->
</style>
<script type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
</script>
</head>

<body>
<table width="1003" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="3"><img src="images/bg2_06 (3).gif" width="1003" height="160"></td>
  </tr>
  <tr>
    <td width="101" align="right" background="images/b_02.gif">&nbsp;</td>
    <td width="812" valign="top"><table width="812" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="626" height="97"><img src="images/bg2_06 (5).gif" width="626" height="97"></td>
        <td rowspan="2"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td><img src="images/bg2_06 (6).gif" width="186" height="244"></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td valign="top">
		
		
		
		
		
		
		
		
		<table width="620" border="0" cellpadding="0" cellspacing="0">
  	<?php 
  		$result=mysql_query("select * from tb_vote_subject where tb_vote_subject_name='".$_GET[vote_subject]."'");
  		while($myrow=mysql_fetch_array($result)){
  		$tpzt=$myrow[tpzt];
  	?>
  	<tr>
    	<td width="39">&nbsp;</td>
    	<td colspan="2" ><a href="main.php"><?php echo $myrow[tb_vote_subject_name];?></a></td>
    	<td width="454" height="35"><span >&nbsp;说明:&nbsp;<?php echo $myrow[tb_vote_subject_text];?></span></td>
  	</tr>
  	<?php }?>
</table>
<?php 
	$query1="select * from tb_vote_odd where tb_vote_subject='".$_GET[vote_subject]."'";
  	$result1=mysql_query($query1);
  	$myrow1=mysql_fetch_array($result1);
  	$tb_vote_type=$myrow1[tb_vote_type];
	$tb_vote_photo=$myrow1[tb_vote_photo];
  	if($tb_vote_type=="单选"){
?>
		<table width="620" border="1" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" background="images/bg3.gif" bgcolor="#FFFFFF">
	 			<form name="form1" method="post" action="tb_vote_ok.php" enctype="multipart/form-data">
    		<tr>
    			<td height="25" align="center">单选区</td>
    			<td height="25" align="center"> 投票主题(<?php echo $_GET[vote_subject];?>)</td>
    			<td width="255" height="25" align="center" ><a href="see_vote_result.php?vote_subject=<?php echo $_GET[vote_subject];?>">投票结果</a></td>
    		</tr>
		<?php 
			if ($tb_vote_photo==""){
				$query2="select * from tb_vote_odd where tb_vote_subject='".$_GET[vote_subject]."'";
  				$result2=mysql_query($query2);
  				while($myrow2=mysql_fetch_array($result2)){
  		?>
  			<tr>
    			<td width="163" align="center"><span class="style2">&nbsp;&nbsp;<?php echo $myrow2[tb_vote_content];?></span></td>
    			<td width="194">
                	<input name="tb_vote_id" type="radio" value="<?php echo $myrow2[tb_vote_id];?>"> 
   				  <input type="hidden" name="tb_vote_subject" value="<?php echo $myrow2[tb_vote_subject];?>"></td>
				<td align="center">
					<table width="224" cellpadding="0" cellspacing="0">
      					<tr>
        					<td width="161" align="center" class="style2"><?php echo $myrow2[tb_vote_content];?></td>
        					<td width="61" class="style2">&nbsp;<?php echo $myrow2[tb_vote_counts];?></td>
      					</tr>
   				  </table>				</td>
    		</tr>
 		<?php }		?>
 			<tr>
    			<td>&nbsp;</td>
    			<td><input type="submit" name="Submit" value="提交"></td>
    			<td>&nbsp;</td>
    		</tr>
  			</form>   
		<?php
			}else{
		?>
			<tr>
    			<td colspan="3" align="center"><table width="99%" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td width="3%">&nbsp;</td>
                    <td width="96%">	<?php 
					$query2="select * from tb_vote_odd where tb_vote_subject='".$_GET[vote_subject]."'";
  					$result2=mysql_query($query2);
					$m=0;
  					while($myrow2=mysql_fetch_array($result2)){
						$m++;
  				?>
						<table width="150" border="0" align="left" cellpadding="0" cellspacing="0">
          					<tr>
								<td height="25" align="center">

									<table width="135" height="120" border="1" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#FFFFFF">
										<form name="form2" method="post" action="tb_vote_ok.php" enctype="multipart/form-data">
										<tr>
    										<td colspan="2" align="center" valign="bottom" bgcolor="#F3F3F3"><img src="<?php echo substr($myrow2[tb_vote_photo],3,200);?>" width="100" height="80" ></td>
    									</tr>
  										<tr>
    										<td height="20" colspan="2" align="center" bgcolor="#F3F3F3">
												<input name="tb_vote_id" type="hidden" value="<?php echo $myrow2[tb_vote_id];?>">
      											<?php echo $myrow2[tb_vote_content];?>
      											<input type="hidden" name="tb_vote_subject" value="<?php echo $myrow2[tb_vote_subject];?>">
										  <input type="hidden" name="Submit" value="提交"></td>
    									</tr>
  										<tr>
    										<td height="30" align="center" bgcolor="#F3F3F3">
										  <input name="imageField" type="image" id="imageField" src="images/1.gif"></td>
    										<td height="24" align="center" bgcolor="#F3F3F3"><a href="#"><img src="images/2.gif" width="52" height="18" border="0" onClick="MM_openBrWindow('see_voter_information.php?odd_id=<?php echo $myrow2[tb_vote_id];?>','查看投票资料','width=300,height=300')"></a></td>
  										</tr>
  										<tr>
    										<td height="20" colspan="2" align="center" bgcolor="#F3F3F3"><?php echo $myrow2[tb_vote_counts];?></td>
    									</tr>
  										</form>
							  </table>								</td>
          					</tr>
				  </table>
				<?php 
					if ($m%5==0)
						echo "<br /><br /><br /><br /><br /><br /><br /><br /><br /><br />";

					}
				?>	</td>
                    <td width="1%">&nbsp;</td>
                  </tr>
                </table>					  </td>
			</tr>
	<?php  }	?>
</table>
<?php 
	}
?>
<!--多选-->
  <?php 
  $query3="select * from tb_vote_more where tb_vote_subject='".$_GET[vote_subject]."'";
  $result3=mysql_query($query3);
  $myrow3=mysql_fetch_array($result3);
  $tb_vote_type=$myrow3[tb_vote_type];
  if($tb_vote_type=="多选"){
  ?>
  <table width="620" border="1" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" background="images/bg3.gif" bgcolor="#FFFFFF">
  <tr>
    <td width="163" height="28" align="center" >多选区</td>
    <td width="194" align="center" >投票主题(<?php echo $_GET[vote_subject];?>)</td>
    <td width="255" align="center" ><a href="see_vote_results.php?vote_subject=<?php echo $_GET[vote_subject];?>">投票结果</a></td>
  </tr>
<?php if($myrow3[tb_vote_photo]==""){?>
<form name="form3" method="post" action="tb_vote_ok.php?more_subject=<?php echo $_GET[vote_subject];?>">
  
 <?php 
  $query4="select * from tb_vote_more where tb_vote_subject='$_GET[vote_subject]' ";
  $result4=mysql_query($query4);
  while($myrows4=mysql_fetch_array($result4)){
  ?>
  <tr>
    <td align="center" class="style2">&nbsp;&nbsp;<?php echo $myrows4[tb_vote_content];?></td>
    <td>
      <label>      	
      <input name="<?php echo $myrows4[tb_vote_id];?>" type="checkbox" value="<?php echo $myrows4[tb_vote_id];?>">  
      </label></td>
    <td align="center"><table width="200" cellpadding="0" cellspacing="0">
      <tr>
        <td width="120" align="center" class="style2"><?php echo $myrows4[tb_vote_content];?></td>
        <td width="174" class="style2">&nbsp;<?php echo $myrows4[tb_vote_counts];?></td>
      </tr>
    </table></td>
  </tr>
  <?php }?>
  <tr>
    <td align="right">&nbsp;</td>
    <td>&nbsp;
      <input type="submit" name="Submit2" value="提交"></td>
    <td>&nbsp;</td>
  </tr>
  </form>
<?php }else{ ?>
<form name="form5" method="post" action="tb_vote_ok.php?more_subject=<?php echo $_GET[vote_subject];?>" enctype="multipart/form-data">						
<tr bgcolor="#ECF6FF">
    <td colspan="3" align="center" class="style2">
		<?php 
					$query5="select * from tb_vote_more where tb_vote_subject='".$_GET[vote_subject]."'";
  					$result5=mysql_query($query5);
					$i=0;
  					while($myrow5=mysql_fetch_array($result5)){
						$i++;
  				?>
						<table width="150" border="0" align="left" cellpadding="0" cellspacing="0">
          					<tr>
								<td height="25">
									<table width="150" height="90" border="0" cellpadding="0" cellspacing="0">
				
										<tr>
    										<td colspan="2" align="center" valign="bottom"><img src="<?php echo substr($myrow5[tb_vote_photo],3,200);?>" width="150" height="80" ></td>
    									</tr>
  										<tr>
    										<td height="20" colspan="2" align="center">
												
      											<?php echo $myrow5[tb_vote_content];?>											</td>
    									</tr>
  										<tr>
    										<td height="30" align="center">
												<input name="<?php echo $myrow5[tb_vote_id];?>" type="checkbox" value="<?php echo $myrow5[tb_vote_id];?>">											</td>
    										<td height="24" align="center"><a href="#"><img src="images/2.gif" width="52" height="18" border="0" onClick="MM_openBrWindow('see_voter_information.php?more_id=<?php echo $myrow5[tb_vote_id];?>','查看投票资料','width=300,height=300')"></a></td>
  										</tr>
  										<tr>
    										<td height="20" colspan="2" align="center"><?php echo $myrow5[tb_vote_counts];?></td>
    									</tr> 									
								  </table>								</td>
          					</tr>
      					</table>
				<?php 
					if ($i%5==0)
	echo "<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />";
					}
				?>	</td>
</tr>
 <tr bgcolor="#ECF6FF">
    <td align="right">&nbsp;</td>
    <td>&nbsp;
      <input type="submit" name="Submit2" value="提交"></td>
    <td>&nbsp;</td>
  </tr>
	</form>
<?php }?>
</table>
<?php }?>		</td>
        </tr>
      <tr>
        <td height="59"><img src="images/bg2_06 (1).gif" width="626" height="59"></td>
        <td>&nbsp;</td>
      </tr>
    </table></td>
    <td width="90" background="images/bg2_06.gif">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="3"><img src="images/bg2_06 (2).gif" width="1003" height="90"></td>
  </tr>
</table>
</body>
</html>
<?php }else{
	echo "<script>alert('请您正确登录！');window.location.href='index.php';</script>";
}?>