Tryag File Manager
Home
||
Turbo Force
||
B-F Config_Cpanel
Current Path :
/
home
/
nayongnua
/
domains
/
nayongnua.go.th
/
public_html
/
webboard2
/
Or
Select Your Path :
Upload File :
New :
File
Dir
/home/nayongnua/domains/nayongnua.go.th/public_html/webboard2/edit.php
<? session_start(); if($user==""){ $message = "กรุณา Login ก่อน."; $url = "../admin/index.php"; include("../admin/alert.php"); exit; } ?> <!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 --> <title>องค์การบริหารส่วนตำบลนาโยงเหนือ หมู่ที่ 4 ถนนนาโยง - ย่านตาขาว ตำบลนาโยงเหนือ อำเภอนาโยง จังหวัดตรัง 92170 : www.nayongnue.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 --> <script language="JavaScript" type="text/JavaScript"> <!-- function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } //--> </script> <script type="text/javascript" language="JavaScript1.2" src="../Templates/stm31.js"></script> <style type="text/css"> <!-- body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; background-color: #0099FF; } .style2 {color: #CC6633} --> </style></head> <body background="../images/tem_b1.jpg" style="background-repeat:no-repeat; background-position:top"> <div align="center" > <table width="980" border="0" cellpadding="0" cellspacing="0"> <tr> <td valign="top"><div align="center"> <table width="980" border="0" cellpadding="0" cellspacing="0"> <tr> <td valign="top"><div align="center"> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="980" height="650"> <param name="movie" value="../images/head.swf"> <param name="quality" value="high"> <embed src="../images/head.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="980" height="650"></embed> </object> </div></td> </tr> </table> </div></td> </tr> <tr> <td> <tr> <td valign="top"><div align="center"> <table width="980" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="50" valign="top"> </td> </tr> <tr> <td height="1500" valign="top"><div align="center"><!-- InstanceBeginEditable name="EditRegion3" --> <TABLE width="750" border=0 cellpadding=0 cellspacing=0 > <TR> <TD class="title2"><div align="center"><img src="../images/13.png" width="264" height="42"></div></TD> </TR> <tr align="center" > <td align="left" class="styles1"> </td> </tr> <tr align="center" > <td align="left" class="styles1"><div align="right"><a href="../admin/main.php" class="styles2">หน้า Admin</a> | <a href="admin.php" class="styles2">กระดานเสวนา </a>| <a href="../admin/signout.php" class="styles2">ออกจากระบบ </a></div></td> </tr> <TR> <TD class="styles2" > </TD> </TR> <TR> <TD class="styles2" ><div align="center"> <? include("./config.inc.php"); //ตั้งค่าต่างๆของเวปบอร์ด include("./function.php"); //ฟังก์ชั่นที่ใช้ในเวปบอร์ด // ถ้ามี "ไฟล์หัวข้อคำถาม" อยู่ให้ทำต่อ.. if(file_exists($fileQuestion)) { if($select==0){ // มีค่าเป็นศูนย์ (0) คือการลบคำถาม // เพิ่มเลข ศูนย์ หน้าหมายเลขคำถาม 4 ตัว (สำหรับแสดงผล) $number = sprintf("%04d",$admin_Q); // อ่านข้อมูลจาก "ไฟล์หัวข้อคำถาม" ไปเก็บในตัวแปร Array $question = file($fileQuestion); // วนลูปอ่านข้อมูล เพื่อตรวจสอบ "การมีอยู่" ของคำถามที่ต้องการลบ $Yes=0; for ($i=0 ; $i<sizeof($question) ; $i++){ // แยกข้อมูลในแต่ละบรรทัด ออกเป็นฟิลด์ย่อย $split = explode("|X|",$question[$i]); if($split[0] == $admin_Q){$Yes=1;} //ถ้ามีหมายเลขคำถามที่ต้องการลบ ให้ตัวแปร $Yes = 1 } //จบลูป for i // ถ้ามีหมายเลขคำถาม ($Yes = 1) ให้ทำตามนี้ if($Yes==1){ for ($i=0 ; $i<sizeof($question) ; $i++){ // แยกข้อมูลในแต่ละบรรทัด ออกเป็นฟิลด์ย่อย $split = explode("|X|",$question[$i]); if($split[0] == $admin_Q){$pos=$i;} // เก็บค่าตำแหน่งของหมายเลขคำถามที่ต้องการลบออกจากไฟล์ } //จบลูป for i // บันทึกหัวข้อคำถามไว้ใน "ไฟล์หัวข้อคำถาม" (จะไม่รวมคำถามที่ต้องการลบ) $save=fopen($fileQuestion,"w"); flock($save,2); for ($j=0 ; $j<sizeof($question) ; $j++){ // ถ้าค่า $j ไม่ตรงกับค่าตำแหน่งของคำถามที่ต้องการลบ ให้บันทึกข้อมูลลง List หรือ "ไฟล์หัวข้อคำถาม" //เพราะฉะนั้นคำถามที่ต้องการลบจึงไม่ถูกบันทึกลงใน "ไฟล์หัวข้อคำถาม" if($j!=$pos){ fputs($save,$question[$j]); } } flock($save,3); fclose($save); // ลบไฟล์ที่เก็บคำถาม $fileQ="./$dataDir/$admin_Q.txt"; if(file_exists($fileQ)) unlink($fileQ); // ลบไฟล์รูปที่อยู่ในคำถาม $fileQImg="./$dataDir/imagefiles/$admin_Q"; if(file_exists("$fileQImg.jpg")) unlink("$fileQImg.jpg"); if(file_exists("$fileQImg.gif")) unlink("$fileQImg.gif"); // ลบไฟล์ที่เก็บจำนวนคนตอบ $fileNum="./$dataDir/$admin_Q.dat"; if(file_exists($fileNum)) unlink($fileNum); // ลบไฟล์ที่เก็บคำตอบ $fileR="./$dataDir/R$admin_Q.txt"; if(file_exists($fileR)) unlink($fileR); // ลบไฟล์รูปที่อยู่ในคำตอบ $fileNumImgR="./$dataDir/imagefiles/Img$admin_Q.txt"; $fileImgR="./$dataDir/imagefiles/R$admin_Q"; if(file_exists($fileNumImgR)) { // อ่านจำนวนของรูปจากไฟล์ if(file_exists($fileNumImgR)) { $FILE=fopen($fileNumImgR,"rt"); $numImg=fgets($FILE,10); fclose($FILE); } for ($i=1 ; $i<=$numImg ; $i++){ if(file_exists("$fileImgR-$i.jpg")) unlink("$fileImgR-$i.jpg"); if(file_exists("$fileImgR-$i.gif")) unlink("$fileImgR-$i.gif"); } unlink($fileNumImgR); } echo "<BR><BR><span class= title>ลบกระทู้หมายเลข <font color=black>$number</font> ออกจากระบบแล้ว","<BR><BR>พร้อมทั้งลบข้อมูลคำตอบของกระทู้นี้ด้วย</span><BR><BR><BR><BR>"; exit(); } // ถ้าไม่มีหมายเลขคำถามให้แสดงข้อความนี้ else{ echo "<BR><BR><BR><span class= title>กระทู้หมายเลข <font color=black>$number</font> ไม่มีอยู่ในระบบ!!","<BR><BR>กรุณาตรวจสอบกระทู้ ที่ต้องการลบอีกครั้ง</span><BR><BR><BR><BR><BR>"; exit(); } } else{ // มีค่าเป็นหนึ่ง (1) หรือไม่เท่ากับศูนย์คือการลบคำตอบ // เพิ่มเลข ศูนย์ หน้าหมายเลขคำถาม 4 ตัว (สำหรับแสดงผล) $number = sprintf("%04d",$admin_Q); // อ่านข้อมูลจาก "ไฟล์หัวข้อคำถาม" ไปเก็บในตัวแปร Array if(file_exists($fileQuestion)) { $question = file($fileQuestion); } // วนลูปอ่านข้อมูล เพื่อตรวจสอบ "การมีอยู่" ของคำถามที่ต้องการลบ $qYes=0; for ($i=0 ; $i<sizeof($question) ; $i++){ // แยกข้อมูลในแต่ละบรรทัด ออกเป็นฟิลด์ย่อย $split = explode("|X|",$question[$i]); if($split[0] == $admin_Q){$qYes=1;} //ถ้ามีหมายเลขคำถาม ของคำตอบที่ต้องการลบ ให้ตัวแปร $qYes = 1 } //จบลูป for i // ถ้ามีหมายเลขคำถาม ($qYes = 1) ให้ทำตามนี้ if($qYes==1){ //อ่านข้อมูลจากไฟล์ ที่เก็บคำตอบ มาเก็บไว้ในตัวแปร Array ชื่อ $Reply $fileReply="./$dataDir/R$admin_Q.txt"; if(file_exists($fileReply)) { $Reply = file($fileReply); } // วนลูปอ่านข้อมูล เพื่อตรวจสอบ "การมีอยู่" ของคำตอบที่ต้องการลบ $Yes=0; $countR=0; // เป็นตัวบอกว่ามีจำนวนคนตอบกี่คน ขั้นแรกกำหนดเป็นศูนย์ก่อน for ($j=0 ; $j<sizeof($Reply) ; $j++) { // แยกข้อมูลในแต่ละบรรทัด ออกเป็นฟิลด์ย่อย $chk = explode("||",$Reply[$j]); // ตรวจสอบการมีอยู่ของคำตอบ if($chk[0]=="IS_reply$admin_R"){ $Yes=1; $position=$countR; } // ถ้าฟิลด์ที่ 0 ของข้อมูลที่แบ่งออกมา เท่ากับ "IS_reply" (ตัวแบ่งหมายเลขคำถาม) ให้เพิ่มค่า $countR if(substr($chk[0],0,8) == "IS_reply"){ $countR++; } }// จบลูป for j // ถ้ามีคำตอบหมายเลขที่ต้องการลบ ($Yes = 1) ให้ทำตามนี้ if($Yes==1){ $count=0; // วนลูปอ่านข้อมูล และบันทึกลง "ไฟล์คำตอบ" ยกเว้นคำตอบที่ต้องการลบ $save=fopen($fileReply,"w"); flock($save,2); for ($i=0 ; $i<sizeof($Reply) ; $i++) { // แยกข้อมูลในแต่ละบรรทัด ออกเป็นฟิลด์ย่อย $split = explode("||",$Reply[$i]); // ถ้าค่า $count ไม่ตรงกับค่าของ $position ให้บันทึกข้อมูล // เพราะฉะนั้นคำตอบที่ต้องการลบจึงไม่ถูกบันทึกลงไปด้วย if($count!=$position){ fputs($save,$Reply[$i]); } // ถ้าฟิลด์ที่ 0 ของข้อมูลที่แบ่งออกมา เท่ากับ "IS_reply" (ตัวแบ่งหมายเลขคำถาม) ให้เพิ่มค่า $count if(substr($split[0],0,8) == "IS_reply"){ $count++; } }// จบลูป for i flock($save,3); fclose($save); // ลบไฟล์รูปที่อยู่ในคำตอบที่ต้องการลบ นี้ด้วย $fileImgR="./$dataDir/imagefiles/R$admin_Q"; if(file_exists("$fileImgR-$admin_R.jpg")) unlink("$fileImgR-$admin_R.jpg"); if(file_exists("$fileImgR-$admin_R.gif")) unlink("$fileImgR-$admin_R.gif"); echo "<BR><BR><BR><span class= title>ลบคำตอบที่ <font color=black>$admin_R</font> ออกจากระบบแล้ว","<BR><BR>โดยลบคำตอบของกระทู้หมายเลข $number</span><BR><BR><BR><BR><BR>"; exit(); } // ถ้าไม่มีคำตอบหมายเลขที่ต้องการลบ ให้แสดงข้อความนี้ else{ echo"<BR><BR><BR><span class= title>คำตอบที่ <font color=black>$admin_R</font> ของกระทู้หมายเลข <font color=black>$number</font> ไม่มีอยู่ในระบบ","<BR><BR>กรุณาตรวจสอบกระทู้ - คำตอบที่ต้องการลบอีกครั้ง</span><BR><BR><BR><BR><BR>"; exit(); }//end if } // ถ้าไม่มีคำถามหมายเลขที่ต้องการลบ ให้แสดงข้อความนี้ else{ echo "<BR><BR><BR><span class= title>กระทู้หมายเลข <font color=black>$number</font> ไม่มีอยู่ในระบบ","<BR><BR>กรุณาตรวจสอบคำถามที่ต้องการลบอีกครั้ง</span><BR><BR><BR>"; exit(); } }//end if } // จบส่วนของ if ที่ตรวจสอบว่าไฟล์ หัวข้อคำถาม มีหรือไม่ else{ // ถ้าไม่มีไฟล์ หัวข้อคำถาม (ซึ่งจะเป็นได้เมื่อยังไม่มีใครตั้งกระทู้แรก หรือกระทู้ที่ 0001) จะแสดงข้อความนี้ echo "<BR><BR><BR><span class= title>ยังไม่มีกระทู้ - คำตอบอยู่ในระบบ","<BR><BR>กรุณาตรวจสอบอีกครั้ง</span><BR><BR><BR><BR><BR>"; } ?> </div></TD> </TR> <TR> <TD class="styles2" > </TD> </TR> </TABLE> <!-- InstanceEndEditable --></div></td> </tr> </table> </div></td> </tr> <tr> <td height="200" valign="top"><table width="980" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="100" valign="top" background="../images/foot.jpg"><div align="center" class="footer"> <p><img src="../images/foot1.png" width="980" height="675" border="0" usemap="#Map6"> <map name="Map3"> <area shape="rect" coords="561,157,826,175" href="http://main.pasworld.co.th/" target="_blank"> </map> </p> <p> </p> </div></td> </tr> </table></td> </tr> </table> </div> <map name="Map"><area shape="rect" coords="464,116,966,154" href="http://main.pasworld.co.th/" target="_blank"> </map> <map name="Map2"><area shape="rect" coords="613,181,964,215" href="http://main.pasworld.co.th/" target="_blank"> </map> <map name="Map4"><area shape="rect" coords="569,179,832,202" href="http://main.pasworld.co.th/" target="_blank"> </map> <map name="Map5"><area shape="rect" coords="335,199,642,224" href="http://main.pasworld.co.th/" target="_blank"> </map> <map name="Map6"><area shape="rect" coords="333,628,642,647" href="http://main.pasworld.co.th/" target="_blank"> </map></body> <!-- InstanceEnd --></html>