www
/
wwwroot
/
magazinmiorita.be
/
admin
➕ New
📤 Upload
✎ Editing:
add_discount.php
← Back
<?php include('../includes/inc.config.php'); include('check_session.php'); $products_results = array(); $products = $database->execute(" SELECT * FROM `products` "); while($row = $database->fetch($products)){ $products_results[] = $row; } $smarty->assign("products", $products_results); if(isset($_POST['add'])){ $product = $_POST['pid']; $price = $_POST['old_price']; $discount = $_POST['discount']; $new_price = $_POST['new_price']; $expiry = strtotime($_POST['expire']); $add_promo = $database->execute("INSERT INTO `discounts` (`pid`, `price`, `discount`, `new_price`, `expiry`, `indate`) VALUES ('$product', '$price', '$discount', '$new_price', '$expiry', '".time()."')"); if($add_promo){ header('Location: discounts.php?m=ok'); exit; }else{ $smarty->assign("type", 'err'); $smarty->assign("message", 'Promotion can not be created! Please check and try again.'); } } $smarty->display(END_PATH.'add_discount.tpl'); ?>
💾 Save Changes
Cancel
📤 Upload File
×
Select File
Upload
Cancel
➕ Create New
×
Type
📄 File
📁 Folder
Name
Create
Cancel
✎ Rename Item
×
Current Name
New Name
Rename
Cancel
🔐 Change Permissions
×
Target File
Permission (e.g., 0755, 0644)
0755
0644
0777
Apply
Cancel