0byt3m1n1-V2
Path:
/
home
/
bangtoey
/
domains
/
bangtoey.go.th
/
public_html
/
webboard
/
[
Home
]
File: search.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><!-- InstanceBegin template="/Templates/template_a.dwt.php" codeOutsideHTMLIsLocked="false" --> <head> <!-- InstanceBeginEditable name="doctitle" --> <!-- InstanceEndEditable --> <?php require_once('../admin/Connections/conndb.php'); mysql_select_db($database_conndb, $conndb); ?> <title>องค์การบริหารส่วนตำบลบางเตย ที่อยู่ 8/8 หมู่2 ตำบลบางเตย อำเภอเมืองฉะเชิงเทรา จังหวัดฉะเชิงเทรา 24000 ::www.bangtoey.go.th</title> <meta http-equiv="Content-Type" content="text/html; charset=windows-874"> <link href="../styles.css" rel="stylesheet" type="text/css"> <!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable --> <style type="text/css"> <!-- body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; background-color: #3CFFFF; } --> </style> <!--styles --> <link href="../styles.css" rel="stylesheet" type="text/css" /> <link href="../css/Hover%20Buttons.css" rel="stylesheet" type="text/css"/> <link href="../css/Hoverable-Sidenav.css" rel="stylesheet" type="text/css"/> <!--<script src="https://platform-api.sharethis.com/js/sharethis.js#property=5d255a83d97c100012d80679&product='inline-share-buttons' async='async" type='text/javascript'> --> </script> <!--styles --> <!--menutop hover --> <link href="../imagehover.css-master/css/demo-page.css" rel="stylesheet" media="all"> <link href="../imagehover.css-master/css/imagehover.min.css" rel="stylesheet" media="all"> <link rel='shortcut icon' type='image/x-icon' href='/favicon.ico' /> <!--end --> <style type="text/css"> <!-- a:link { text-decoration: none; } a:visited { text-decoration: none; } a:hover { text-decoration: none; } a:active { text-decoration: none; } .style6 {color: #FFFFFF} --> </style></head> <body background="../images/0bg1.png" style="background-repeat:no-repeat; background-position:top"> <!--<div id="mySidenav" class="sidenav"> <a href="http://new.huayyai.go.th/index.php" id="about"> </a> <a href="http://new.huayyai.go.th/news.php?cat_id=1" id="blog"> </a> <a href="http://new.huayyai.go.th/news.php?cat_id=4" id="projects"> </a> <a href="http://new.huayyai.go.th/albums/index.php" id="contact"> </a> </div> --> <!-- content --> <div align="center"> <table width="950" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td align="center" valign="top"><tr> <td height="650" align="center" valign="top" background="../images/head-1.png" style="background-repeat:no-repeat"><table width="980" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="515" align="center" valign="top"> </td> </tr> <tr> <td height="364" align="center" valign="top"><iframe src="/title_head.html" width="980" height="335" scrolling="no" frameborder="0" marginheight="0" marginwidth="0"></iframe></td> </tr> <tr> <td align="center" valign="top"><iframe src="/menu-top.html" width="980" height="53" scrolling="no" frameborder="0" marginheight="0" marginwidth="0"></iframe></td> </tr> <tr> <td height="150" align="center" valign="top"> </td> </tr> </table></td> </tr> </td> </tr> <tr> <td align="center" valign="top"><table width="980" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td align="center" valign="top"> </td> </tr> <tr> <td align="center" valign="top"><!-- InstanceBeginEditable name="EditRegion3" --> <TABLE width="750" border=0 cellpadding=0 cellspacing=0 > <TR> <TD class="title2"><div align="center"><img src="../images/botton/borad.png" width="640" height="78"></div></TD> </TR> <TR> <TD class="styles"><div align="center"></div></TD> </TR> <TR> <TD height="40" class="styles2" ><div align="left"> <a href="webboard.php" class="styles2">[ กลับหน้ากระดานเสวนา</a> | <a href="new.php" class="styles2">ตั้งกระทู้ใหม่</a> ]</div></TD> </TR> <TR> <TD class="styles2" ><div align="center"> <? include("./config.inc.php"); //ตั้งค่าต่างๆของเวปบอร์ด include("./function.php"); //ฟังก์ชั่นที่ใช้ในเวปบอร์ด if (empty($sequence)) { $selected[0]=selected; } if ($sequence == 1) { $selected[1]=selected; } if ($sequence == 2) { $selected[2]=selected; } if (empty($page)){ $page=1; } $stop = $page * $list_page; $start = $stop - $list_page; if(file_exists($fileQuestion)) { $question = file($fileQuestion); $count = 0; //เป็นตัวเพิ่ม ค่าตำแหน่ง ของ Array for ($i=0 ; $i<sizeof($question); $i++) { // แยกข้อมูลในแต่ละบรรทัด ออกเป็นฟิลด์ย่อย $split = explode("|X|",$question[$i]); // ค้นหาจากหัวข้อคำถาม if( ereg("($search)",$split[0]) ) { $ArrayQ_Discover[$count] = $question[$i]; //เก็บคำถามที่ค้นพบลง Array $count++; } // จบ if // ค้นหาจากคำถาม if( ereg("($search)",$split[1]) ) { $split[1] = eregi_replace($search,"<b> $search </b>",$split[1]); // ทำตัวหนาให้คำที่ต้องการค้น $ArrayQ_Discover[$count] = "$split[0]|X|$split[1]|X|$split[2]|X|$split[3]|X|$split[4]|X|$split[5]|X|$split[6]|X|"; //เก็บคำถามที่ค้นพบลง Array $count++; } // จบ if // ค้นหาจากชื่อผู้ตั้งคำถาม if( ereg("($search)",$split[2]) ) { $ArrayQ_Discover[$count] = $question[$i]; //เก็บคำถามที่ค้นพบลง Array $count++; } // จบ if } //จบ for i // เรียงตาม ( วันที่ ) ที่มีคนตอบ if($sequence==1){ for ($i=0 ; $i<(sizeof($ArrayQ_Discover)-1); $i++) { for ($j=0 ; $j<(sizeof($ArrayQ_Discover)-1); $j++) { // แยกข้อมูลในแต่ละบรรทัด ออกเป็นฟิลด์ย่อย $split = explode("|X|",$ArrayQ_Discover[$j]); $split1 = explode("|X|",$ArrayQ_Discover[$j+1]); if($split1[6] >= $split[6]){ $swap = $ArrayQ_Discover[$j]; $ArrayQ_Discover[$j] = $ArrayQ_Discover[$j+1]; $ArrayQ_Discover[$j+1] = $swap; } //จบ if } //จบ for j } //จบ for i } //จบ if $sequence .. 1 // เรียงตามจำนวนคนตอบ if($sequence==2){ for ($i=0 ; $i<(sizeof($ArrayQ_Discover)-1); $i++) { for ($j=0 ; $j<(sizeof($ArrayQ_Discover)-1); $j++) { // แยกข้อมูลในแต่ละบรรทัด ออกเป็นฟิลด์ย่อย $split = explode("|X|",$ArrayQ_Discover[$j]); $split1 = explode("|X|",$ArrayQ_Discover[$j+1]); //======================================== // วนลูปอ่านข้อมูลหาจำนวนผู้เข้าชม และวันที่ล่าสุดที่ตอบคำถาม $fileVisitor = "./$dataDir/$split[0].dat"; if(file_exists($fileVisitor)) { $lineVisitor = file($fileVisitor); // แยกข้อมูลในแต่ละบรรทัด ออกเป็นฟิลด์ย่อย $chkVisitor = explode("||",$lineVisitor[0]); $ReplyNum = $chkVisitor[0]; //จำนวนผู้ตอบคำถาม } $fileVisitor = "./$dataDir/$split1[0].dat"; if(file_exists($fileVisitor)) { $lineVisitor = file($fileVisitor); // แยกข้อมูลในแต่ละบรรทัด ออกเป็นฟิลด์ย่อย $chkVisitor = explode("||",$lineVisitor[0]); $ReplyNum1 = $chkVisitor[0]; //จำนวนผู้ตอบคำถาม }//======================================== if($ReplyNum1 >= $ReplyNum){ $swap = $ArrayQ_Discover[$j]; $ArrayQ_Discover[$j] = $ArrayQ_Discover[$j+1]; $ArrayQ_Discover[$j+1] = $swap; } //จบ if } //จบ for j } //จบ for i } //จบ if $sequence .. 2 // แสดงจำนวนของกระทู้ ที่ค้นหาได้.. echo "<table width='98%'><tr>"; echo "<form method=post action=\"./search.php\" name=\"SearchForm\" onsubmit=\"return check();\">"; echo "<td width='44%' class='styles3'>ผลจากการค้นหาคำว่า \"<font color=red><b>$search</b></font>\" <BR>เจอทั้งหมดจำนวน \"<font color=red><b>$count</b></font>\"กระทู้</td>\n"; echo "<td width='56%' align=right valign=baseline class=styles3><img src=\"./pic/search.gif\"> ค้นหาคำถาม "; echo "<input type=text name=search size=20 maxlength=100 class=violet> "; echo "<input type=submit value='ค้นหา' name=submit class=BUTTON>"; echo "</td>"; echo "</form></tr>"; echo "</table>"; // ถ้าค้นหาคำถามพบทำงานต่อ if($count>=1) { // แสดงหัวข้อต่างๆ ของตารางแสดงกระทู้ echo "<TABLE align=center cellSpacing=0 cellPadding=0 width=98% border=0 bgcolor=#000000>"; echo "<TR><TD>"; echo "<table width='100%' border=0 cellpadding=3 cellspacing=1 align='center'>"; echo "<tr bgcolor=$headColor>"; echo "<td align=center width=9% class=title3>หัวข้อที่</td>\n"; echo "<td align=center width=40% class=title3>หัวข้อ</td>\n"; echo "<td align=center width=25% class=title3>ผู้ตั้งกระทู้ [วันที่ถาม]</td>\n"; echo "<td align=center width=7% class=title3>อ่าน</td>\n"; echo "<td align=center width=19% class=title3>ตอบ [วันที่ตอบ]</td>\n"; echo "</tr>\n\n"; for ($i=$start ; $i<$count ; $i++) { if($i<$stop){ // แยกข้อมูลในแต่ละบรรทัด ออกเป็นฟิลด์ย่อย $split = explode("|X|",$ArrayQ_Discover[$i]); $numQuestion = $split[0]; // หมายเลขคำถามที่ไม่มีเลข ศูนย์ นำหน้า $Question = $split[1]; //คำถาม $Name = $split[2]; //ผู้ถาม $Date = trim($split[3]); //วันที่ถาม $NumReplyDate = $split[6]; //วันที่ตอบคำถามล่าสุด (ค่าเป็นวินาทีนับจากปี ค.ศ. 1900) // เพิ่มเลข ศูนย์ หน้าหมายเลขคำถาม 4 ตัว $No = sprintf("%04d",$split[0]); // หาจำนวนผู้ตอบทั้งหมด $countR = CountReply($numQuestion); // เป็นตัวบอกว่ามีจำนวนคนตอบกี่คน // วนลูปอ่านข้อมูลหาจำนวนผู้เข้าชม และวันที่ล่าสุดที่ตอบคำถาม $fileVisitor = "./$dataDir/$numQuestion.dat"; if(file_exists($fileVisitor)) { $lineVisitor = file($fileVisitor); // แยกข้อมูลในแต่ละบรรทัด ออกเป็นฟิลด์ย่อย $chkVisitor = explode("||",$lineVisitor[0]); $Visitor = $chkVisitor[1]; //จำนวนผู้เข้าชม $ReplyDate = $chkVisitor[2]; //วันที่ตอบคำถามล่าสุด } // กำหนดสีของตาราง เพื่อให้มีการสลับสี ค่าของตัวแปร $rowColor อยู่ในไฟล์ config $bgc = ($bgc==$rowColor1) ? $rowColor2 : $rowColor1; //ตรวจสอบคนตอบ ในวันนี้ if($Logtime<=($NumReplyDate+86400)) { //86400 วินาที = หนึ่งวัน echo "<tr bgcolor=$rowHiLight>\n"; $chknew="<font color=666666>(มีผู้ตอบวันนี้)</font>"; }else { echo "<tr bgcolor=$bgc>\n"; $chknew=""; } // กำหนดภาพ icon หน้าหมายเลขกระทู้ // ถ้าต้องการให้ icon ของคำถามฮอต แสดงที่จำนวนคนตอบ ที่เท่าไหร่ก็เปลี่ยนตัวเลขเองนะครับ (ในที่นี้คือตอบตั้งแต่ 10 คนขึ้นไป) if($ReplyDate!="-") { $icon = ($countR>=10) ? "<img src='./pic/hotfd.gif'>" : "<img src='./pic/openfd.gif'>"; } else { $icon = ($Date==$mdate) ? "<img src='./pic/newfd.gif'>" : "<img src='./pic/closefd.gif'>"; } // แสดงคำถาม echo "<td align='center' class='styles1'> $icon <b>$No</b></td>\n"; echo "<td><a href='./view.php?No=$numQuestion' target=\"_blank\" class=\"styles2\">$Question</a> $chknew</td>\n"; echo "<td class='styles1'><b> $Name </b>[$Date]</td>\n"; echo "<td align='center' class='styles1'>$Visitor </td>\n"; if($countR!=0){ echo "<td class='styles1'><b> $countR</b> [$ReplyDate]</td>\n"; }else { echo "<td class='styles1'><b> $countR</b></td>\n"; } echo "</tr>\n\n"; } // end if } // end for // ปิดตารางแสดงผลกระทู้ echo "</table>\n"; echo "</TD></TR>\n"; echo "</TABLE>\n"; $rt = $count%$list_page; if($rt!=0) { $totalpage = floor($count/$list_page)+1; } else { $totalpage = floor($count/$list_page); } echo "<table width='98%' border=0 cellpadding=2 cellspacing=0 align='center'><tr><td valign=top colspan='5' class='styles3'>\n"; echo "<img src='./pic/newfd.gif'> =กระทู้ใหม่ \n"; echo "<img src='./pic/closefd.gif'> =กระทู้ที่ยังไม่มีคนตอบ \n"; echo "<img src='./pic/openfd.gif'> =กระทู้ที่ถูกตอบแล้ว \n"; echo "<img src='./pic/hotfd.gif'> =กระทู้สุดฮอต \n"; echo "</td><td align=right>\n"; echo "</td></tr>\n\n"; echo "<tr><td valign=top colspan='5' class='styles3'>\n"; // สร้าง link เพื่อไปหน้าก่อน-หน้าถัดไป if($page>1 && $page<=$totalpage) { $prevpage = $page-1; echo "[<a href='./search.php?search=$search&page=$prevpage'>หน้าก่อน = $prevpage</a>] \n"; } echo "<font color=green>กำลังแสดงหน้าที่ $page/$totalpage</font>\n"; if($page!=$totalpage) { $nextpage = $page+1; echo " [<a href='./search.php?search=$search&page=$nextpage'>หน้าถัดไป = $nextpage</a>]\n"; } echo "<br>[ <b>"; // วนลูปแสดงเลขหน้าทั้งหมด for($i=1 ; $i<$page ; $i++) { echo "<a href='./search.php?search=$search&page=$i'>$i</a> \n"; } echo "<font color=red>$page</font> \n"; for($i=$page+1 ; $i<=$totalpage ; $i++) { echo "<a href='./search.php?search=$search&page=$i'>$i</a>\n"; } echo "</b> ]</td></tr></table>\n\n"; } // จบส่วนการแสดงคำถาม // ถ้าค้นหาไม่พบ else { echo "</table>"; // ปิดตารางของข้อความ [ ตั้งกระทู้ใหม่ | กลับหน้าแรก ] ที่อยู่ในแทก html echo "<br><br><font color=red ><b>\n"; echo "<p align=center>ไม่พบข้อมูลที่ต้องการค้นหาครับ<br></p></b>\n"; echo "</font> <br><br>\n\n"; } } // ถ้าไม่มีไฟล์ หัวข้อคำถาม ให้ทำตามนี้ else { echo "</table>"; // ปิดตารางของข้อความ [ ตั้งกระทู้ใหม่ | กลับหน้าแรก ] ที่อยู่ในแทก html echo "<br><br><font color=red ><b>\n"; echo "<p align=center>ไม่สามารถค้นหาได้ เนื่องจากยังไม่มีใครตั้งคำถามครับ<br></p></b>\n"; echo "</font> <br><br>\n\n"; } ?> </div></TD> </TR> <TR> <TD class="styles2" ><div align="center"> <script language="JavaScript"> function check() { var v1 = document.SearchForm.search.value; if ( v1.length==0) { alert("กรุณาป้อนคำที่ต้องการค้นหา"); document.SearchForm.search.focus(); return false; } else return true; } </script> </div></TD> </TR> </TABLE> <!-- InstanceEndEditable --></td> </tr> </table></td> </tr> <tr> <td align="center" valign="top"> </td> </tr> <tr> <td align="center" valign="top"> </td> </tr> <tr> <td align="center" valign="top" style="background-repeat:no-repeat"><img src="../images/foot.png"></td> </tr> </table> </div> <!-- end_content --> <tr><td><a style="display:scroll;position:fixed;bottom:5px;right:5px;" class="backtotop" href="#top" rel="nofollow" title="Back to Top"><img src="../images/up.png" border="0" /></a></td> </tr> <map name="Map6" id="Map6"><area shape="rect" coords="210,1,302,41" href="http://www.tratlocal.go.th/index.php" target="_blank" /> </map> </body> <!-- InstanceEnd --></html>
©
2018.