| Server IP : 210.245.233.93 / Your IP : 216.73.216.226 Web Server : Apache/2.2.15 (CentOS) System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : apache ( 48) PHP Version : 5.3.3 Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/hkosl.com/kelvin/webadmin/ |
Upload File : |
<?php
include 'config.php';
// Check if the user is logged in
if ((!isSet($_SESSION['loginname'])) || ($loggin <> '1'))
{
header("Location: login.php");
exit;
}
require("configure.php");
$pdcatid = check_input($_GET["pdcatid"]);
$parentid = check_input($_GET["parentid"]);
$pdcatsort = check_input($_GET["pdcatsort"]);
//Delete Category
function getAllCategoryID($pid){
$rtnString = "";
$sqlCmd = " SELECT pdcatid FROM product_cat WHERE parentid=". $pid ." ";
$result = mysql_query($sqlCmd);
if (mysql_num_rows( $result)>0 && mysql_num_rows($result) >0)
{
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$rtnString .= $row{'pdcatid'} .",". getAllCategoryID($row{'pdcatid'});
}
}
return $rtnString;
}
//Delete Image file
/*$result = mysql_query("SELECT * FROM product_cat WHERE pdcatid='".$pdcatid."' ");
$row = mysql_fetch_array($result,MYSQL_ASSOC);
if($row['pdcatimgen'] <> ''){
unlink("../images/product/cat/".$row{'pdcatimgen'});
}
if($row['pdcatimgtc'] <> ''){
unlink("../images/product/cat/".$row{'pdcatimgtc'});
}
*/
//Delete Category
$sql1 = "DELETE FROM product_cat ";
$sql1 .= "where pdcatid in (".substr($pdcatid.','.getAllCategoryID($pdcatid),0, -1).")";
mysql_query($sql1);
if( mysql_errno() > 0 ){
echo 'Delete Product Category Error:<br />'. mysql_error() .'<br />SQL: '. $sql1;
exit;
}
// Update Category Sort
mysql_query("UPDATE product_cat SET pdcatsort = pdcatsort-1 WHERE parentid=". $parentid ." AND pdcatsort >= $pdcatsort ");
mysql_close($dbh);
header("Location: product_cat_index.php?pid=$parentid&msg=Delete Successful");
?>