<?php include('connect.php'); $sql="select*from qq order by rand() limit 3 "; $result=mysql_query($sql,$con); $number=0; ?> <table align="center" width="780" cellpadding="0" cellspacing="0"> <tr> <td><div id="header">ข้อสอบ</div></td> </tr> <tr><td> <div id="maintain"><form action="check_answer.php" method="post"> <table align="center" width="780" border="1"> <? while($arr=mysql_fetch_array($result)){ $id=$arr['id']; $question=$arr['data']; $choice1=$arr['ans1']; $choice2=$arr['ans2']; $choice3=$arr['ans3']; $number++; $i++; echo "<tr> <td> $number </td> <td> $question</td> <td> <input type='radio' name='select_$id' value='1'> $choice1 <input type='radio' name='select_$id' value='2'> $choice2 <input type='radio' name='select_$id' value='3'> $choice3 <input type='hidden' name='total_question[]' value='$id'<br> </td> </tr>"; } ?> <tr> <td colspan="3"><input type="submit" value="click" /><input type="reset" value="reset" /></td> </tr> <tr> <td></td> </tr> </table> </form> </div> </td> </tr> <tr><td> </td></tr> </table>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <? $correct=0; $total=count($total_question); echo $total."<br>"; include('connect.php'); $sql="select id, ans_true from qq order by id"; $result=mysql_query($sql); while ($ar=mysql_fetch_array($result)){ $id=$ar['id']; $answer=$ar['ans_true']; if (in_array($id, $total_question)){ $select="select_".$id; if (${$select}==$answer) { $correct++; } } } echo "ตอบถูก ทั้งหมด $correct <br> คำถามทั้งหมด $total"; ?>
<form name="form1" method="post" action="confirm3.php"> <? $host="localhost"; $username="root"; $password="1234"; $db="database"; $tb="testing"; mysql_connect( $host,$username,$password) or die ("ติดต่อกับฐานข้อมูล Mysql ไม่ได้ "); mysql_select_db($db) or die("เลือกฐานข้อมูลไม่ได้"); mysql_query("SET character_set_results=tis620"); mysql_query("SET character_set_client=tis620"); mysql_query("SET character_set_connection=tis620"); $sql="Select * From $tb order by id limit 50"; $db_query=mysql_query($sql); $i=0; while($result=mysql_fetch_array($db_query)) { $i++; ?> <table width="64%" border="0" align="center"> <tr> <td width="18%"> <div align="left"> <input name="id<?=$i;?>" type="hidden" value="<?=$result["id"];?>"> <?=$result["question"];?> </div></td> </tr> <tr> <td><input name="c<?=$i;?>" type="radio" value="1" checked> <?=$result["c1"];?></td> </tr> <tr> <td><input type="radio" name="c<?=$i;?>" value="2"> <?=$result["c2"];?></td> </tr> <tr> <td><input type="radio" name="c<?=$i;?>" value="3"> <?=$result["c3"];?></td> </tr> <tr> <td><input type="radio" name="c<?=$i;?>" value="4"> <?=$result["c4"];?> <input name="answer<?=$i;?>" type="hidden" value="<?=$result["answer"];?>"></td> </tr> </table><br> <? } mysql_close(); ?> <div align="center"><br> <input type="hidden" name="line" value="<?=$i;?>"> <input type="submit" name="Submit" value="ตรวจคะแนน"> </div> </form>
<form name="form1" method="post" action="updateconfirm3.php"> <div align="center"> <p><? $score=0; for($i=1;$i<=$_POST["line"];$i++) { If($_POST["c$i"] == $_POST["answer$i"]) { $score=$score+1; } } echo "<p align='center'>คุณทำข้อสอบได้ $score คะแนนจาก 30 ข้อ<br>"; ?></p> <table width="182" border="0" bgcolor="#0094DE"> <tr> <td width="176"><div align="center"><span class="style16">คลิกยืนยันสถานะผ่านการทดสอบ</span></div></td> </tr> </table> <br> <table width="200" border="0"> <tr> <td><div align="center"> <select name="txtConfirm" id="txtConfirm" value="<?=$objResult["Sex"];?>"> <option value="1">ผ่านการทดสอบก่อนเรียนแล้ว</option> </select> </div></td> </tr> </table> <label> <select name="txtScore3" id="txtScore3"> <option value="<?php echo"$score"; ?>">คุณทำข้อสอบได้ <?php echo"$score"; ?> คะแนน</option> </select> </label><br> <input type="submit" name="Submit" value="ยืนยัน"> </div> </form>
<? session_start(); if($_SESSION['UserID'] == "") { echo "Please Login!"; exit(); } mysql_connect("localhost","root","1234"); mysql_select_db("database"); mysql_query("SET character_set_results=tis620"); mysql_query("SET character_set_client=tis620"); mysql_query("SET character_set_connection=tis620"); if($_POST["txtPassword"] != $_POST["txtConPassword"]) { echo "ÃËÑʼèÒ¹äÁèµÃ§¡Ñ¹!"; exit(); } $strSQL = "UPDATE member SET Confirm = '".trim($_POST['txtConfirm'])."',Score3 = '".trim($_POST['txtScore3'])."' WHERE UserID = '".$_SESSION["UserID"]."' "; $objQuery = mysql_query($strSQL); header ("Location:contentmain.php"); mysql_close(); ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง