���� JFIF �� � ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /proc/self/root/var/www/html/tien-dien/code/admin/shipping/ |
<?php global $DB, $INFO, $print, $v_lang, $CORE; // Set page title $CORE->page_title = 'Quản lý phương thức vận chuyển | '; // Initialize variables $id = isset($_GET['id']) ? intval($_GET['id']) : 0; $action = isset($_GET['action']) ? $_GET['action'] : ''; // Also check the type parameter from index.php $type = isset($type) ? $type : ''; $shipping = array( 'id' => 0, 'name' => '', 'description' => '', 'cost' => 0, 'status' => 1, 'sort_order' => 0 ); // If editing, get shipping method data if (($action == 'edit' || $type == 'edit') && $id > 0) { $query = "SELECT * FROM tb_shipping_methods WHERE id = '$id'"; $result = $DB->query($query); if ($DB->get_num_rows() > 0) { $shipping = $DB->fetch_row($result); } else { $print->refresh('?act=admin&code=shipping'); exit(); } } // Process form submission if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['submit'])) { // Get form data $name = $DB->real_escape_string($_POST['name']); $description = $DB->real_escape_string($_POST['description']); $cost = floatval($_POST['cost']); $status = isset($_POST['status']) ? 1 : 0; $sort_order = intval($_POST['sort_order']); // Validate form data $errors = array(); if (empty($name)) { $errors[] = 'Vui lòng nhập tên phương thức vận chuyển'; } if (empty($errors)) { // If editing, update existing record if ($id > 0) { $query = "UPDATE tb_shipping_methods SET name = '$name', description = '$description', cost = '$cost', status = '$status', sort_order = '$sort_order' WHERE id = '$id'"; $DB->query($query); $print->refresh('?act=admin&code=shipping&msg=updated'); } // If adding, insert new record else { $query = "INSERT INTO tb_shipping_methods (name, description, cost, status, sort_order) VALUES ('$name', '$description', '$cost', '$status', '$sort_order')"; $DB->query($query); $print->refresh('?act=admin&code=shipping&msg=added'); } exit(); } } ?>