Server IP : 111.118.215.189 / Your IP : 3.133.87.185 Web Server : Apache System : Linux md-in-83.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 User : a1673wkz ( 2475) PHP Version : 8.2.25 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home1/a1673wkz/propstonerealty.com/Admin/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php include("config.php"); //print_r($_POST); //print_r($_FILES); if(!empty($_POST['doctor_id'])) { $product_name=$_POST['product_name']; $id=$_POST['doctor_id']; $old_image=$_POST['old_image']; $price=$_POST['price']; $qty=$_POST['qty']; $offer=$_POST['offer']; $des=base64_encode($_POST['description']); $menu=$_POST['menu']; $submenu=$_POST['submenu']; $category=serialize($_POST['category']); $sel=$obj->num("SELECT * FROM products WHERE id='$id'"); //echo $sel; if($sel!='0') { if(!empty($_FILES['img']['name'])) { $da=$obj->arr("SELECT * FROM products WHERE id='$id'"); $tem=unserialize($da['image']); $t_item=$_POST['total_img']; // echo $t_item; // echo "okkkk"; for($cnt=0;$cnt<$t_item;$cnt++) { $old=$_POST['old_image'][$cnt]; $tim=$tem[$cnt]; if($old==$tim) { // echo "djkgdjf"; $image=$_FILES['img']['name'][$cnt]; if(!empty($_FILES['img']['name'][$cnt])) { unlink($old); $allowed = array('gif', 'png', 'jpg','jpeg','webp'); $ext = pathinfo($image, PATHINFO_EXTENSION); if (in_array($ext, $allowed)) { $tmp_image=$_FILES['img']['tmp_name'][$cnt]; $temp=explode(".", $image); $newfile=rand(00000000,99999999).'.'.end($temp); $folder="images/Products/".$newfile; $new[]=$folder; $upload=move_uploaded_file($tmp_image, $folder); } } else { $new[]=$old; } } else { // echo"ok"; if(!empty($_FILES['img']['name'][$cnt])) { $allowed = array('gif', 'png', 'jpg','jpeg','webp'); $ext = pathinfo($image, PATHINFO_EXTENSION); if (in_array($ext, $allowed)) { $tmp_image=$_FILES['img']['tmp_name'][$cnt]; $temp=explode(".", $image); $newfile=rand(00000000,99999999).'.'.end($temp); $folder="images/Products/".$newfile; $new[]=$folder; $upload=move_uploaded_file($tmp_image, $folder); } // echo"not ok"; } } } $file=serialize($new); // print_r($file); $query=$obj->query("UPDATE products SET product_name='$product_name',description='$des',image='$file', category='$category',menu='$menu',submenu='$submenu',price='$price',qty='$qty',offer='$offer' WHERE id='$id'"); //echo $query; if($query) { echo '<a href="#" class="badge badge-success">Success</a>'; } else { echo '<a href="#" class="badge badge-success">Faild</a>'; } } else { $query=$obj->query("UPDATE products SET product_name='$product_name',description='$des',image='$file', category='$category',menu='$menu',submenu='$submenu',price='$price',qty='$qty',offer='$offer' WHERE id='$id'"); if($query) { echo '<a href="#" class="badge badge-success">Success</a>'; } else { echo '<a href="#" class="badge badge-success">Faild</a>'; } } } else { echo '<a href="#" class="badge badge-warning">Not Exist</a>'; } } else { echo '<a href="#" class="badge badge-warning">Empty Field</a>'; } ?>