D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
realadss
/
kavyaeventz.in
/
admin
/
ajax
/
Filename :
product-insert.php
back
Copy
<?php include"../connection.php"; $category = $_POST['category']; $meta1 = $_POST['meta1']; $meta2 = $_POST['meta2']; $meta3 = $_POST['meta3']; $meta4 = $_POST['meta4']; $video1 = $_POST['video1']; $video2 = $_POST['video2']; $script = $_POST['script']; $pixcel = $_POST['pixcel']; $altb = $_POST['altb']; $alte = $_POST['alte']; $altg = $_POST['altg']; $bannerimage = $_FILES['banner']; // print_r($bannerimage); $temper = $bannerimage['tmp_name']; // print_r($temper); $date = date('y-m-d-H-i-s'); $filebanner = $date."banner.png"; // if(move_uploaded_file($temper, '../images/new/'.$filebanner)){ // echo 'succes'; // }else{ // echo 'du'; // } $pname = $_POST['pname']; $replaceArray0 = array( '"' => """, "'" => "'", ); $modifiedText0 = str_replace(array_keys($replaceArray0), array_values($replaceArray0), $pname); $editordata1 = $_POST['editordata1']; $replaceArray1 = array( '"' => """, "'" => "'", ); $modifiedText1 = str_replace(array_keys($replaceArray1), array_values($replaceArray1), $editordata1); // print_r($modifiedText1); // die(); // $editordata3 = $_POST['editordata3']; // $replaceArray3 = array( // '"' => """, // "'" => "'", // ); // $modifiedText3 = str_replace(array_keys($replaceArray3), array_values($replaceArray3), $editordata3); $date = date("Y-m-d h-i-sa"); $upload_location = "../images/new/"; $countformFile1 = count($_FILES['formFile1']['name']); $files_arr1 = array(); $countformFile2 = count($_FILES['formFile2']['name']); $files_arr2 = array(); for($index = 0; $index < $countformFile1; $index++){ if(isset($_FILES['formFile1']['name'][$index]) && $_FILES['formFile1']['name'][$index] != ''){ $images = "images".$index; $filename = $images.$date.$index.$_FILES['formFile1']['name'][$index]; $path = $upload_location.$filename; if(move_uploaded_file($_FILES['formFile1']['tmp_name'][$index],$path)){ $files_arr1[] = $filename; // echo 'jftrt'; } } } for($index = 0; $index < $countformFile2; $index++){ if(isset($_FILES['formFile2']['name'][$index]) && $_FILES['formFile2']['name'][$index] != ''){ $images = "images".$index; $filename = $images.$date.$index.$_FILES['formFile2']['name'][$index]; $path = $upload_location.$filename; if(move_uploaded_file($_FILES['formFile2']['tmp_name'][$index],$path)){ $files_arr2[] = $filename; } } } $names_str1 = implode(', ', $files_arr1); $names_str2 = implode(', ', $files_arr2); move_uploaded_file($temper, '../images/new/'.$filebanner); $sql = "INSERT INTO `products`(`catagory`, `pname`, `video1`, `video2`, `script`, `pixcel`, `banner`, `meta1`, `meta2`, `meta3`, `meta4`, `description`, `thumbnail_image`, `detail_image`, `altb`, `alte`, `altg`, `status`, `createdate`) VALUES ('$category', '$modifiedText0', '$video1', '$video2', '$script', '$pixcel', '$filebanner', '$meta1', '$meta2', '$meta3', '$meta4', '$modifiedText1', '$names_str1', '$names_str2', '$altb', '$alte', '$altg', '1', '$date')"; // echo $sql; // die(); $query = mysqli_query($conn, $sql); if($query){ echo 1; }else{ echo 2; } ?>