Linux altar53.supremepanel53.com 4.18.0-553.8.1.lve.el8.x86_64 #1 SMP Thu Jul 4 16:24:39 UTC 2024 x86_64
/ home/ bdapparelinfo/ hi-techplasticltd.com/ Wp-Administrator/ modul/ |
|
<?php $form_error = array(); if(isset($_POST['addcat'])){ $cat_parent_name = $_POST['cat_parent_name']; $cat_name = addslashes($_POST['cat_name']); $cat_position = $_POST['cat_position']; $sir_no = $_POST['sir_no']; //$image = $_FILES['image']['name']; $parentsCatID=mysql_fetch_array(mysql_query("SELECT * FROM `menu` WHERE `id`='$cat_parent_name'")); $t=time(); $image = $t.$_FILES['image']['name']; $array = explode(".", $_FILES["image"]["name"]); $extension = end( $array); $allowedExts = array("jpg", "jpeg", "gif", "png"); if(!in_array($extension, $allowedExts) && $_FILES["image"]["size"] > 20000 && $_FILES["image"]["error"] > 0) { $upload_error['upload_error'] = 'This file is not allowed to upload'; } else { move_uploaded_file($_FILES['image']['tmp_name'], "../media/" .$t.$_FILES['image']['name']); } if($cat_parent_name=='26' || $parentsCatID['parents_cat_id']=='26'){ $url_link = addslashes('product.php?page='); } else if($cat_parent_name=='22' OR $parentsCatID['parents_cat_id']=='22'){ $url_link = addslashes('gallery.php?page='); }else{ $url_link = addslashes('about.php?page='); } //echo $url_link; exit; /*echo $cat_name; exit;*/ $add_cat = $function_file->addcat($cat_name, $cat_parent_name, $url_link, $cat_position, $sir_no, $image); }// end inserting User $ID=$_GET['id']; //$edit_pages = $function_file->edit_pages_id($ID); $view_sub_cat=mysql_fetch_array(mysql_query("SELECT * FROM `menu` WHERE `id`='$ID'")); $Parent_cat=$view_sub_cat['parents_cat_id']; $IMG = $view_sub_cat['image']; if(isset($_POST['edicat'])){ $cat_edit_id = $_POST['edit_id']; $cat_parent_name = $_POST['cat_parent_name']; $cat_name = addslashes($_POST['cat_name']); $cat_position = $_POST['cat_position']; $sir_no = $_POST['sir_no']; //echo $_FILES['image']['name']; exit; $t=time(); if($_FILES['image']['name']){ $image = $t.$_FILES['image']['name']; $array = explode(".", $_FILES["image"]["name"]); $extension = end( $array); $allowedExts = array("jpg", "jpeg", "gif", "png"); if(!in_array($extension, $allowedExts) && $_FILES["image"]["size"] > 20000 && $_FILES["image"]["error"] > 0) { $upload_error['upload_error'] = 'This file is not allowed to upload'; } else { move_uploaded_file($_FILES['image']['tmp_name'], "../media/" .$t.$_FILES['image']['name']); unlink("../media/".$_POST['img_old1']); } }else{ $image = $_POST['img_old1']; } /*echo $cat_name; exit;*/ $add_cat = $function_file->editcat($cat_edit_id, $cat_parent_name, $cat_name, $cat_position, $sir_no, $image); }// end inserting User ?>