0byt3m1n1-V2
Path:
/
home
/
bangtoey
/
domains
/
bangtoey.go.th
/
public_html
/
webboard
/
admin
/
[
Home
]
File: deltopic.php
<? session_start(); if(!isset($_SESSION["user"]) or ($_SESSION["user"]=="")){ $message = "กรุณา Login ก่อน."; $url = "../../admin/index.php"; include("../../admin/alert.php"); exit; } if(isset($_GET["No"])){ $No = $_GET["No"]; } else { die("ไม่มีเลขที่กระทู้"); } if(isset($_GET["Category"])){ $Category = $_GET["Category"]; } ?> <html> <head> <title>-=- ลบข้อมูลเรียบร้อยแล้ว -=-</title> <meta http-equiv="Content-Type" content="text/html; charset=windows-874"> <link rel="stylesheet" href="../style.css" type="text/css"> </head> <body bgcolor="#FFFFFF"> <? require("../config.inc.php"); // 1. เชื่อมต่อฐานข้อมูลและเลือก DB $conn = mysql_connect($host, $user_db, $passwd_db) or die("เชื่อมต่อ Server ไม่ได้"); mysql_select_db($dbname, $conn) or die("ติดต่อฐานข้อมูล $dbname ไม่ได้"); mysql_query("SET NAMES 'tis620'"); // 2. ลบรูปภาพจากหัวข้อกระทู้ (Table: webboard_data) $sql_c = "SELECT nphoto FROM webboard_data WHERE No='$No'"; $c_query = mysql_query($sql_c) or die("Error SQL (Data): " . mysql_error()); while($c_arr = mysql_fetch_array($c_query)) { if($c_arr['nphoto'] != "") { $file_com = "../$path/" . $c_arr['nphoto']; if (file_exists($file_com)) { @unlink($file_com); } } } // 3. ลบรูปภาพจากความคิดเห็น (Table: webboard_ans) $sql_c1 = "SELECT nphoto FROM webboard_ans WHERE QuestionNo='$No'"; $c_query1 = mysql_query($sql_c1) or die("Error SQL (Ans): " . mysql_error()); while($c_arr1 = mysql_fetch_array($c_query1)) { if($c_arr1['nphoto'] != "") { $file_com1 = "../$path/" . $c_arr1['nphoto']; if (file_exists($file_com1)) { @unlink($file_com1); } } } // 4. ลบข้อมูลจากฐานข้อมูล $sql_del_data = "DELETE FROM webboard_data WHERE No='$No'"; mysql_query($sql_del_data) or die("ไม่สามารถลบกระทู้ได้: " . mysql_error()); $sql_del_ans = "DELETE FROM webboard_ans WHERE QuestionNo='$No'"; mysql_query($sql_del_ans) or die("ไม่สามารถลบคำตอบได้: " . mysql_error()); mysql_close(); // 5. ส่งกลับหน้าหลัก echo "<meta http-equiv=refresh content=0;URL=admin.php?Category=$Category>"; ?> </body> </html>
©
2018.