mysql_select_db("db_online")or die("不能选择数据库:".mysql_error());
    mysql_query("set names gb2312");//字符转换
?>
/*考生登陆*/
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312"/>
<title>网站登录</title>
<style type="text/css">
<!--
</style>
</head>
<body>
<table width="500" height="50" border="0" cellpadding="0" cellspacing="0">
  <tr>
     <td>&nbsp;</td>
  </tr>
  </table>
  <form name="fomal1" method="post" action="denglu_ok.php"
  <table width="592" height="103" border="1" cellpadding="1" cellspacing="1" bodercolor="#FFFFFF" bgcolor="#676767">
  
  </table>
   <tr>
    <td with="104" bgcolor="EEEEEE">&nbsq;</td>
    <td with="178" bgcolor="#FFFFFF">&nbsq;</td>
    <td with="74" bgcolor="#EEEEEE">&nbsq;</td>
    <td with="208" bgcolor="#FFFFFF">&nbsq;</td> 
   </tr>
   <tr>
       <td align="center" bgcolor="EEEEEE"><span class="STYLE1">准考证号:</span></td>
       <td bgcolor="FFFFFF"><input name="online_number" type="text" id="online_number" size="20"/></td>
       <td align="center" bgcolor="EEEEEE"><span class="STYLE1">密码:</span></td>
       </tr>
       <tr>
            <td bgcolor="EEEEEE"&nbsq;</td>
            <td bgcolor="#FFFFFF"&nbsq;</td>
            <td bgcolor="EEEEEE"><input type="submit" name="Submit" value="提交"/></td>
            <td bgcolor="#FFFFFF"><input type="reset"  value="清空"/></td>
       </tr>
</table>
</form>
</body>
</html>        
 /*考生登录验证*/          
<?php
   session_start();
   include("conn/conn.php");//连接数据文件
   $online_number=isset($_REQUEST["online_number"]);//获取整好
   $online_pass=isset($_REQUST["online_pass"]);//获取密码
   /*检索考试证号和密码是否正确*/
   $sql="select*from tb_user where online_number=‘{$online_number}'andonline_pass='{$online_pass}''';
   mysql_query($sql);
   $result=mysql_affected_rows();
          if($result<1){
    echo"<script>alert('用户名或密码错误');histroy.go(-1);</script>";
    
    }    
    else{ session_register("online_number");
       echo"<script>alert('登录成功!');window.location.href='index.php?online=进入考场';</script>"
         }
?>
<?php
    $query1=mysql_query("select*from tiku where c_name='$c_name'and type='dx'");
    $y=1;
    $fen1=0;
    while($myrow1=mysql_fetch_array($query1))
?>
    <tr><td width="443" height="20" bgcolor="#FFFFFF" class="STYLE1">
    &nbsq;&nbsq;
<?php
    echo $y.".".$myrow1["timu"]
?>
</td>
<td bgcolor="#FFFFFF" class="STYLE1"><span class="STYLE4">
<?php
   echo $myrow1['fenzhi'];
?>
分</span></td></tr>
<?php
    $array1=explode("*",$myrow1["options"]);
    if($_POST['Submit']!="")
    {
         for($a=0;$a<count($array1);$a++)
         { 
             if($array1[$a]!="")
             {
              if($array1[$a]==$_POST[$myrow1['kt_id']])
            {
                $str1=$_POST[$myrow1['kt_id']];
            }}
    }}
    for($a=0;$a<count($array1);$a++)
    {
        if($array1[$a]!="")
        {
            
        }
     }
?>
     <tr><td height="20" bgcolor="#FFFFFF" class="STYLE1">&nbsp;&nbsp;
     <input type="radio" name="
<?php 
     echo $myrow1['kt_id'];
?>
    "value="
<?php 
    echo $array1[$a];
?>
">
<?php 
    echo $array1[$a];
?>
</td><td bgcolor="#FFFFFF" class="STYLE1">&nbsq;
<?php 
    if($_POST[$myrow1['kt_id']]==true)
    {
        if($myrow1["ans"]==$str1)
        {
            echo"您输入的答案&nbsq;";
            echo"<font color='#FF0000'>".substr($str1,0)."</font>";
            echo"&nbsq;正确&nbsq;&nbsq;分数:";
            echo"<font color='#FF0000'>".$myrow1['fenzhi']."</font>";
              $fen1+=$myrow1["fenzhi"];
        }
           else{
               echo"您输入的答案&nbsq;";
               echo"&nbsq;错误&nbsq;&nbsq;";
                    echo"正确答案:&nbsq;<font color='#FF0000'>".substr1($myrow1['ans'],0)."</font>";
                    
        }
    }
?>
</td>
<?php 
    $y++;?>