0byt3m1n1-V2
Path:
/
home
/
bangtoey
/
domains
/
bangtoey.go.th
/
public_html
/
news
/
[
Home
]
File: delete_detail.php
<?php session_start(); if($_SESSION[user]==""){ session_destroy(); $message = "¡ÃسÒ Login ¡è."; $url = "../admin/index.php"; include("../admin/alert.php"); exit; } require_once('../admin/Connections/conndb.php'); mysql_select_db($database_conndb, $conndb); if (isset($_GET['cat_id'])) { $cat_id=$_GET['cat_id']; } $query_rsNews = "SELECT * FROM news_detail where id = '$id'"; $rsNews = mysql_query($query_rsNews, $conndb) or die(mysql_error()); $row_rsNews = mysql_fetch_assoc($rsNews); $totalRows_rsNews = mysql_num_rows($rsNews); if($_GET[id]!=""){ $sql="SELECT * FROM news_detail_file WHERE id=".$_GET[id]; $res=mysql_query($sql,$conndb) or die(mysql_error()); while($f=mysql_fetch_object($res)){ if(file_exists("doc_download/".$f->path)){ unlink("doc_download/".$f->path); } } $del2="delete from news_detail_file WHERE id=".$_GET[id]; mysql_query($del2,$conndb) or die(mysql_error()); } ?> <?php function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue; switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } if ((isset($_GET['id'])) && ($_GET['id'] != "")) { $deleteSQL = sprintf("DELETE FROM news_detail WHERE id=%s", GetSQLValueString($_GET['id'], "int")); // ลบไฟล์เอกสารู้ if($row_rsNews['filename']!=""){ $QFile=$row_rsNews['filename']; echo $QFile; $fileQFile="doc_download/$QFile"; if(file_exists("$fileQFile")) unlink("$fileQFile"); } // ลบไฟล์ภาพ if($row_rsNews['pic']!=""){ $QPic=$row_rsNews['pic']; echo $QPic; $fileQPic="photo/$QPic"; if(file_exists("$fileQPic")) unlink("$fileQPic"); } if($row_rsNews['pic2']!=""){ $QPic=$row_rsNews['pic2']; echo $QPic; $fileQPic="photo/$QPic"; if(file_exists("$fileQPic")) unlink("$fileQPic"); } if($row_rsNews['pic3']!=""){ $QPic=$row_rsNews['pic3']; echo $QPic; $fileQPic="photo/$QPic"; if(file_exists("$fileQPic")) unlink("$fileQPic"); } if($row_rsNews['pic4']!=""){ $QPic=$row_rsNews['pic4']; echo $QPic; $fileQPic="photo/$QPic"; if(file_exists("$fileQPic")) unlink("$fileQPic"); } if($row_rsNews['pic5']!=""){ $QPic=$row_rsNews['pic5']; echo $QPic; $fileQPic="photo/$QPic"; if(file_exists("$fileQPic")) unlink("$fileQPic"); } if($row_rsNews['pic6']!=""){ $QPic=$row_rsNews['pic6']; echo $QPic; $fileQPic="photo/$QPic"; if(file_exists("$fileQPic")) unlink("$fileQPic"); } if($row_rsNews['pic7']!=""){ $QPic=$row_rsNews['pic7']; echo $QPic; $fileQPic="photo/$QPic"; if(file_exists("$fileQPic")) unlink("$fileQPic"); } if($row_rsNews['pic8']!=""){ $QPic=$row_rsNews['pic8']; echo $QPic; $fileQPic="photo/$QPic"; if(file_exists("$fileQPic")) unlink("$fileQPic"); } mysql_select_db($database_conndb, $conndb); $Result1 = mysql_query($deleteSQL, $conndb) or die(mysql_error()); // $deleteGoTo = "admin.php"; if (isset($_SERVER['QUERY_STRING'])) { $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?"; $deleteGoTo .= $_SERVER['QUERY_STRING']; } // header(sprintf("Location: %s", $deleteGoTo)); echo "<meta http-equiv='refresh' content='0;URL=admin.php?cat_id=".$cat_id."'>"; } if($conndb) { mysql_close($conndb); unset($conndb); } ?>
©
2018.