www
/
wwwroot
/
magazinmiorita.be
/
admin
➕ New
📤 Upload
✎ Editing:
add_product.php
← Back
<?php include('../includes/inc.config.php'); include('check_session.php'); if(isset($_POST['add'])){ $id = $_POST['id']; $code = $_POST['code']; $name = $_POST['name']; $measure = $_POST['measure']; $product_info = $_POST['product_info']; $description = $_POST['description']; $price = $_POST['price']; $cat_id = $_POST['cat_id']; $scat_id = $_POST['scat_id']; $sku = $_POST['sku']; $weight = $_POST['weight']; $status = $_POST['status']; $filename = $_FILES['thumb']['name']; $ext = substr($filename, strrpos($filename, '.') + 1); // Thumb Image $thumb = "../uploads/images/".md5($filename)."_".time().".".$ext; $thumb_db = "uploads/images/".md5($filename)."_".time().".".$ext; $prod_id = $_GET['id']; $type = $_POST['type']; $weight = $_POST['weight']; //$weight = $database->execute("INSERT INTO `prod_weight`(`prod_id`, `type`, `weight`)VALUES('$prod_id', '$type', '$weight')"); $add_product = $database->execute("INSERT INTO `products` (`id`, `code`, `name`, `measure`, `product_info`, `description`, `price`, `thumb`, `cat_id`, `scat_id`, `sku`, `weight`, `status`) VALUES ('$id', '$code', '$name', '$measure', '$product_info', '$description', '$price', '$thumb_db', '$cat_id', '$scat_id', '$sku', '$weight', '$status')"); if($add_product){ if (is_uploaded_file($_FILES['thumb']['tmp_name'])) { copy($_FILES['thumb']['tmp_name'], $thumb); } $message = 'Product added successfully!'; $msg_type = 'succ'; }else{ $message = 'Error! Product can not be added, please check and try again.'; $msg_type = 'err'; } } $categories_results = array(); $categories = $database->execute(" SELECT * FROM `categories` "); while($row = $database->fetch($categories)){ $categories_results[] = $row; } $smarty->assign("message", $message); $smarty->assign("type", $msg_type); $smarty->assign("categories", $categories_results); $smarty->display(END_PATH.'add_product.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