ok
Direktori : /home2/selectio/www/ |
Current File : /home2/selectio/www/test.php |
<?php error_log('form startss'); include_once('config/config.php'); include_once('config/custom-functions.php'); include 'config/send-sms.php'; // $return_arr = array(); $product_ids= $_POST['ids']; // $gender_op1 = $_POST['gender_op1'] ? 1 : 0; // $gender_op2 = $_POST['gender_op2'] ? 1 : 0; // $gender_op3 = $_POST['gender_op3'] ? 1 : 0; // $field1=$_POST['field1']; // $field1_datatype=$_POST['field1_datatype']; // $field2=$_POST['field2']; // $field2_datatype=$_POST['field2_datatype']; // $field3=$_POST['field3']; // $field3_datatype=$_POST['field3_datatype']; // $field4=$_POST['field4']; // $field4_datatype=$_POST['field4_datatype']; // $field5=$_POST['field5']; // $field5_datatype=$_POST['field5_datatype']; // $field6=$_POST['field6']; // $field6_datatype=$_POST['field6_datatype']; // $field7=$_POST['field7']; // $field7_datatype=$_POST['field7_datatype']; // $field8=$_POST['field8']; // $field8_datatype=$_POST['field8_datatype']; // $field9=$_POST['field9']; // $field9_datatype=$_POST['field9_datatype']; // $field10=$_POST['field10']; // $field10_datatype=$_POST['field10_datatype']; // $field11=$_POST['field11']; // $field11_datatype=$_POST['field11_datatype']; // $field12=$_POST['field12']; // $field12_datatype=$_POST['field12_datatype']; // $field13=$_POST['field13']; // $field13_datatype=$_POST['field13_datatype']; // $field14=$_POST['field14']; // $field14_datatype=$_POST['field14_datatype']; // $field15=$_POST['field15']; // $field15_datatype=$_POST['field15_datatype']; // $gender =$_POST['gender']; // $gender_op1 =$_POST['gender_op1']; // $gender_op2 =$_POST['gender_op2']; // $male_products =$_POST['male_products']; // $male_products1 =$_POST['male_products1']; // $male_products2 =$_POST['male_products2']; // $male_products3 =$_POST['male_products3']; // $male_products4 =$_POST['male_products4']; // $male_products5 =$_POST['male_products5']; // $male_products6 =$_POST['male_products6']; // $male_products7 =$_POST['male_products7']; // $male_products8 =$_POST['male_products8']; // $male_products9 =$_POST['male_products9']; // $male_products10 =$_POST['male_products10']; // $female_products =$_POST['female_products']; // $female_products1 =$_POST['female_products1']; // $female_products2 =$_POST['female_products2']; // $female_products3 =$_POST['female_products3']; // $female_products4 =$_POST['female_products4']; // $female_products5 =$_POST['female_products5']; // $female_products6 =$_POST['female_products6']; // $female_products7 =$_POST['female_products7']; // $female_products8 =$_POST['female_products8']; // $female_products9 =$_POST['female_products9']; // $female_products10 =$_POST['female_products10']; // $select1=$_POST['select1']; // $option1_1=$_POST['option1_1']; // $option1_2=$_POST['option1_2']; // $option1_3=$_POST['option1_3']; // $option1_4=$_POST['option1_4']; // $option1_5=$_POST['option1_5']; // $option1_6=$_POST['option1_6']; // $option1_7=$_POST['option1_7']; // $option1_8=$_POST['option1_8']; // $option1_9=$_POST['option1_9']; // $filter_main1 = $_POST['filter_main1'] ?? null; // $image_filter1 = $_POST['image_filter1'] ?? null; // $image_filter_old1 = $_POST['image_filter_old1'] ?? null; // $filter_main2 = $_POST['filter_main2'] ?? null; // $image_filter2 = $_POST['image_filter2'] ?? null; // $image_filter_old2 = $_POST['image_filter_old2'] ?? null; // $filter_main3 = $_POST['filter_main3'] ?? null; // $image_filter3 = $_POST['image_filter3'] ?? null; // $image_filter_old3 = $_POST['image_filter_old3'] ?? null; // $filter_main4 = $_POST['filter_main4'] ?? null; // $image_filter4 = $_POST['image_filter4'] ?? null; // $image_filter_old4 = $_POST['image_filter_old4'] ?? null; // $filter_main_male1 = $_POST['filter_main_male1'] ?? null; // $image_filter_male1 = $_POST['image_filter_male1'] ?? null; // $image_filter_male_old1 = $_POST['image_filter_male_old1'] ?? null; // $filter_main_male2 = $_POST['filter_main_male2'] ?? null; // $image_filter_male2 = $_POST['image_filter_male2'] ?? null; // $image_filter_male_old2 = $_POST['image_filter_male_old2'] ?? null; // $filter_main_male3 = $_POST['filter_main_male3'] ?? null; // $image_filter_male3 = $_POST['image_filter_male3'] ?? null; // $image_filter_male_old3 = $_POST['image_filter_male_old3'] ?? null; // $filter_main_male4 = $_POST['filter_main_male4'] ?? null; // $image_filter_male4 = $_POST['image_filter_male4'] ?? null; // $image_filter_male_old4 = $_POST['image_filter_male_old4'] ?? null; // $filter_main_female1 = $_POST['filter_main_female1'] ?? null; // $image_filter_female1 = $_POST['image_filter_female1'] ?? null; // $image_filter_female_old1 = $_POST['image_filter_female_old1'] ?? null; // $filter_main_female2 = $_POST['filter_main_female2'] ?? null; // $image_filter_female2 = $_POST['image_filter_female2'] ?? null; // $image_filter_female_old2 = $_POST['image_filter_female_old2'] ?? null; // $filter_main_female3 = $_POST['filter_main_female3'] ?? null; // $image_filter_female3 = $_POST['image_filter_female3'] ?? null; // $image_filter_female_old3 = $_POST['image_filter_female_old3'] ?? null; // $filter_main_female4 = $_POST['filter_main_female4'] ?? null; // $image_filter_female4 = $_POST['image_filter_female4'] ?? null; // $image_filter_female_old4 = $_POST['image_filter_female_old4'] ?? null; // /*image move directory code */ // function uploadImage($file, $target_dir) { // $target_file = '../'.$target_dir . basename($file["name"]); // $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // $check = getimagesize($file["tmp_name"]); // if ($check === false) { // error_log("File is not an image"); // } // if (file_exists($target_file)) { // error_log("Sorry, file already exists"); // } // if ($file["size"] > 5000000) { // error_log("Sorry, your file is too large"); // } // if (!in_array($imageFileType, ["jpg", "jpeg", "png", "gif"])) { // error_log("Sorry, only JPG, JPEG, PNG & GIF files are allowed"); // } // if (move_uploaded_file($file["tmp_name"], $target_file)) { // return ["status" => true, "message" => "The file " . basename($file["name"]) . " has been uploaded.", "file_path" => $target_file]; // } else { // error_log("Sorry, there was an error uploading your file"); // } // } // $target_dir = "products/"; // $old_image_link = $_POST['old_image_link']; // $new_image_link = $old_image_link; // Default to old image link // if (!empty($_FILES['image']['name'])) { // $upload_result = uploadImage($_FILES['image_filter1'], $target_dir); // if ($upload_result['status']) { // $new_image_link = $upload_result['file_path']; // echo $upload_result['message']; // } else { // echo $upload_result['message']; // } // } $stmt = $pdo->prepare("SELECT * FROM tbl_product_seller WHERE id = ?"); $stmt->execute([$product_ids]); $result = $stmt->fetch(PDO::FETCH_ASSOC); if ($result) { echo "already available update"; }else{ echo "GEN".$gender_op1; echo "GEN".$gender_op2; echo "GEN".$gender_op3; /*-----------------------------------*/ // Process sub-fields // Insert sub fields $genders = ['gender_op1' => 'Male', 'gender_op2' => 'Female', 'gender_op3' => 'Unisex']; echo '<pre>'; print_r($_POST['subFields']); echo '</pre>'; foreach ($genders as $gender_key => $gender_value) { if (!empty($_POST[$gender_key])) { $gender_field_id = str_replace('gender_op', '', $gender_key); // foreach ($_POST['subFields'][additionalFields] as $subField) { foreach ($_POST['subFields']["additionalFields".$gender_field_id] as $subField) { echo '<pre>'; print_r($subField); echo '</pre>'; $sub_field_name = $subField['value']; // $image_path = uploadFile($_FILES["subFields"][$gender_field_id][$subField['id']]['image']); // $stmt = $pdo->prepare("INSERT INTO sub_fields (product_id, gender, sub_field_name, image_path) VALUES (?, ?, ?, ?)"); // $stmt->execute([$product_id, $gender_value, $sub_field_name, $image_path]); // $sub_field_id = $pdo->lastInsertId(); // Insert sub-sub fields echo "-------m---------"; print_r($subField); // if (isset($subField['subSubFields'])) { // if (isset($subField['fieldGroupadditionalFields'.$gender_field_id."_".1])) { if (isset($subField)) { echo "----------------<br>"; echo "----------------<br>"; // foreach ($_POST['subFields']["additionalFields".$gender_field_id] as $subField) { foreach ($subField["additionalFields".$gender_field_id]['subSubFields'] as $subSubIndex => $subSubField) { echo "testing starts"; echo"<pre>"; print_r($subSubField); echo"</pre>"; $sub_sub_field_name = $subSubField['value']; // $sub_sub_image_path = uploadFile($_FILES["subFields"][$gender_field_id][$subField['id']]['subSubFields'][$subSubField['id']]['image']); // $stmt = $pdo->prepare("INSERT INTO sub_sub_fields (sub_field_id, sub_sub_field_name, sub_sub_image_path) VALUES (?, ?, ?)"); // $stmt->execute([$sub_field_id, $sub_sub_field_name, $sub_sub_image_path]); } } } } } /*-----------------------*/ } // if($_REQUEST['$product_ids']){field // } // $statement = $pdo->prepare("INSERT INTO `tbl_product_seller` // (`product_ids`, `field1`, `field1_datatype`, `field2`, `field2_datatype`, // `field3`, `field3_datatype`, `field4`, `field4_datatype`, // `field5`, `field5_datatype`, `field6`, `field6_datatype`, // `field7`, `field7_datatype`, `field8`, `field8_datatype`, // `field9`, `field9_datatype`, `field10`, `field10_datatype`, // `field11`, `field11_datatype`, `field12`, `field12_datatype`, // `field13`, `field13_datatype`, `field14`, `field14_datatype`, // `field15`, `field15_datatype`, `select1`, `option1_1`, `option1_2`, `option1_3`, `option1_4`, `option1_5`, `option1_6` // , `option1_7`, `option1_8`, `option1_9`,`gender`,`gender_op1`,`gender_op2`,`male_products`,`male_products1`,`male_products2`,`male_products3`, // `male_products4`,`male_products5`,`male_products6`,`male_products7`,`male_products8`,`male_products9`,`male_products10`,`female_products`,`female_products1`, // `female_products2`,`female_products3`,`female_products4`,`female_products5`,`female_products6`,`female_products7`,`female_products8`,`female_products9`,`female_products10`) // VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); // $result = $statement->execute([$product_ids, $field1, $field1_datatype, $field2, $field2_datatype, // $field3, $field3_datatype, $field4, $field4_datatype, // $field5, $field5_datatype, $field6, $field6_datatype, // $field7, $field7_datatype, $field8, $field8_datatype, // $field9, $field9_datatype, $field10, $field10_datatype, // $field11, $field11_datatype, $field12, $field12_datatype, // $field13, $field13_datatype, $field14, $field14_datatype, // $field15, $field15_datatype,$select1, $option1_1, $option1_2, $option1_3, $option1_4, $option1_5, $option1_6, $option1_7, $option1_8, $option1_9, // $gender, $gender_op1, $gender_op2, $male_products, $male_products1, $male_products2, $male_products3, $male_products4, // $male_products5, $male_products6, $male_products7, $male_products8, $male_products9, $male_products10, $female_products, $female_products1, // $female_products2, $female_products3, $female_products4, $female_products5, $female_products6, $female_products7, $female_products8, $female_products9, $female_products10]); // if ($result) { // header("Location:../sub_product.php?ids=".$product_ids); // exit(); // } else { // echo "Error occurred while inserting data."; // } ?>