CasperSecurity
<?php
session_start();
include '../../../../web/connection/connection.php';
include '../../../../web/connection/con.php';
include '../../../../web/connection/functions/encryption.php';
$itemid = $_REQUEST['item_id'];
$brandid = $_REQUEST['brand_id'];
$subgroup_id = $_REQUEST['subgroup_id'];
$item_type = $_REQUEST['item_type'];
$subgroup_ide = amebi_crypt($subgroup_id,e);
$item_photo1 = $_FILES['item_photo1']['name'];
$photoPath = "../../../../web/uploads/imguploads/";
$imgtype = pathinfo($item_photo1,PATHINFOEXTENSION);
$maxsize = 2097152;
$tempname = $_FILES['item_photo1']['tmp_name'];
$photoUpload = move_uploaded_file($tempname,$photoPath.$item_photo1);
$item_photo2 = $_FILES['item_photo2']['name'];
$photoPath = "../../../../web/uploads/imguploads/";
$imgtype = pathinfo($item_photo2,PATHINFOEXTENSION);
$maxsize = 2097152;
$tempname = $_FILES['item_photo2']['tmp_name'];
$photoUpload = move_uploaded_file($tempname,$photoPath.$item_photo2);
$item_photo3 = $_FILES['item_photo3']['name'];
$photoPath = "../../../../web/uploads/imguploads/";
$imgtype = pathinfo($item_photo3,PATHINFOEXTENSION);
$maxsize = 2097152;
$tempname = $_FILES['item_photo3']['tmp_name'];
$photoUpload = move_uploaded_file($tempname,$photoPath.$item_photo3);
$item_photo4 = $_FILES['item_photo4']['name'];
$photoPath = "../../../../web/uploads/imguploads/";
$imgtype = pathinfo($item_photo4,PATHINFOEXTENSION);
$maxsize = 2097152;
$tempname = $_FILES['item_photo4']['tmp_name'];
$photoUpload = move_uploaded_file($tempname,$photoPath.$item_photo4);
date_default_timezone_set("Asia/Kolkata");
$date = date("Y-m-d H:i:s");
$active = 'yes';
$userId = $_SESSION['USER_ID'];
$db_handle = new DBController();
$numrowss = $db_handle->numRows("SELECT * FROM item_image WHERE item_id = '$itemid' AND brand_id = '$brandid'");
if($numrowss >= '1'){
$_SESSION['ERROR_MSG'] = "Image Already Exist";
$_SESSION['MSG_ALRT'] = "FALSE";
header('location:../../../../web/home/modules/stock/item_image/item_image_upload.php?item_sgroups='.$subgroup_id);
}else{
$db_handle = new DBController();
$newInsert = $db_handle->tableinsert("INSERT INTO item_image (item_id,brand_id,Image1,Image2,Image3,Image4,created_on,created_by,is_active)
VALUES ('$itemid','$brandid','$item_photo1', '$item_photo2','$item_photo3','$item_photo4','$date','$userId','$active')");
if($newInsert == TRUE){
$_SESSION['ERROR_MSG'] = "Image Uploaded Successfully";
$_SESSION['MSG_ALRT'] = "TRUE";
header('location:../../../../web/home/modules/stock/item_image/item_image_upload.php?item_sgroups='.$subgroup_id.'&item_type='.$item_type);
}else{
$_SESSION['ERROR_MSG'] = "Unsuccess";
$_SESSION['MSG_ALRT'] = "FALSE";
header('location:../../../../web/home/modules/stock/item_image/item_image_upload.php');
}
}