MMCT TEAM
Server IP : 111.118.215.189  /  Your IP : 3.139.64.23
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  ]

Current File : /home1/a1673wkz/propstonerealty.com/Admin/edit_property_form.php
<?php 
include("config.php");
// print_r($_FILES['floor_plan']);
error_reporting(0);
if(!empty($_POST['location']) && !empty($_POST['sub_location']) && !empty($_POST['pro_type']) && !empty($_POST['pro_cat']) 
&& !empty($_POST['status']) && !empty($_POST['pro_name']) && !empty($_POST['pro_full_ads']) && !empty($_POST['description'])
&& !empty($_POST['details']) && !empty($_POST['payment_plan']) && !empty($_POST['pro_overview']) && !empty($_POST['min_price']) && !empty($_POST['company'])
&& !empty($_POST['area']) && !empty($_POST['doctor_id']))

{
    $location=$_POST['location'];
    $sub_location=$_POST['sub_location'];
    
   if(!empty($_POST['bhk']))
    {
        $sq='';
        $comm_type='';
        $bhk=serialize($_POST['bhk']);
    }
    else
    {
        $bhk='';
        $sq=$_POST['sq'];
        $comm_type=$_POST['comm_type'];
    }
    
    $pro_type=$_POST['pro_type'];
    $pro_cat=$_POST['pro_cat'];
    $status=serialize($_POST['status']);
    $pro_name=$_POST['pro_name'];
    $pro_full_ads=$_POST['pro_full_ads'];
    $description=base64_encode($_POST['description']);
    $details=base64_encode($_POST['details']);
    $amenities=serialize($_POST['amenities']);
    $ameniti_aprt=serialize($_POST['ameniti_aprt']);
    $loc_map=base64_encode($_POST['loc_map']);
    $payment_plan=base64_encode($_POST['payment_plan']);
    
    
    $pro_overview=base64_encode($_POST['pro_overview']);
    $specification=base64_encode($_POST['specification']);
    $video_link=base64_encode($_POST['video_link']);
    $company=$_POST['company'];
    $area=$_POST['area'];
    
     $min_price=$_POST['min_price'];
    $max_price=$_POST['max_price'];



    $brochure_old=$_POST['brochure_old'];
    $id=$_POST['doctor_id'];
    $cr_date=date('Y-m-d');
    
     $floor_file=array();
   //  print_r($_FILES['floor_plan']['name']);
    if(!empty($_FILES['floor_plan']['name'][0]))
    {
        //echo"ko";
           
            foreach($_FILES['floor_plan']['name'] as $key=>$val)
            {
                    $floor_plan=$_FILES['floor_plan']['name'][$key];
                    $floor_plan_old=$_POST['old_image_floor'][$key];
                    if($floor_plan_old==$floor_plan)
                    {
                        if(!empty($_FILES['floor_plan']['name'][$key]))
                        {
                            unlink($floor_plan_old);
                            $allowed_floor = array('gif', 'png', 'jpg','jpeg','webp');
                            $ext_floor = pathinfo($floor_plan, PATHINFO_EXTENSION);
                            if (in_array($ext_floor, $allowed_floor)) 
                            {
                                $tmp_floor=$_FILES['floor_plan']['tmp_name'][$key];
                                $temp_floor=explode(".", $floor_plan);
                                $newfile_floor=rand(00000000,99999999).'.'.end($temp_floor);
                                $folder_floor="images/Products/".$newfile_floor;
                                $floor_file[]=$folder_floor;
                                $upload_floor=move_uploaded_file($tmp_floor, $folder_floor);
                            }
                        }
                        else
                        {
                            $floor_file[]=$floor_plan_old;
                        }
                    }
                    else if(!empty($_FILES['floor_plan']['name'][$key]))
                    {
                        $floor_plan=$_FILES['floor_plan']['name'][$key];
                         $allowed_floor = array('gif', 'png', 'jpg','jpeg','webp');
                        $ext_floor = pathinfo($floor_plan, PATHINFO_EXTENSION);
                        if (in_array($ext_floor, $allowed_floor)) 
                        {
                            $tmp_floor=$_FILES['floor_plan']['tmp_name'][$key];
                            $temp_floor=explode(".", $floor_plan);
                            $newfile_floor=rand(00000000,99999999).'.'.end($temp_floor);
                            $folder_floor="images/Products/".$newfile_floor;
                            $floor_file[]=$folder_floor;
                            move_uploaded_file($tmp_floor, $folder_floor);
                        }
                                
                    }
            }
                
    }
    else
    {
       $ocount=count((array) $_POST['old_image_floor']);
       for($x=0;$x<$ocount;$x++)
       {
        $floor_file[]=$_POST['old_image_floor'][$x];
       }
    }
    // print_r($floor_file);
    $new_floor_plan=serialize($floor_file);
    
    
    if(!empty($_FILES['brochure']['name']))
    {
        unlink($brochure_old);
        $brochure=$_FILES['brochure']['name'];
        $allowed_bro = array('gif', 'png', 'jpg','jpeg','webp');
        $ext_bro = pathinfo($brochure, PATHINFO_EXTENSION);
        if (in_array($ext_bro, $allowed_bro)) 
        {
            $tmp_bro=$_FILES['brochure']['tmp_name'];
            $temp_bro=explode(".", $brochure);
            $newfile_bro=rand(00000000,99999999).'.'.end($temp_bro);
            $folder_bro="images/Products/".$newfile_bro;
            $upload_bro=move_uploaded_file($tmp_bro, $folder_bro);
        }
    }
    else
    {
        $folder_bro=$brochure_old;
    }



    if(!empty($_FILES['img']['name']))
		{
			$da=$obj->arr("SELECT * FROM property 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);
	        
	        
	        
	        if(!empty($_POST['ameniti_aprt']))
	        {
	            $up=$obj->query("UPDATE property SET  ameniti_aprt='$ameniti_aprt' WHERE id='$id'");
	        }
            
            
            if(!empty($_POST['amenities']))
            {
            $update=$obj->query("UPDATE property SET location='$location', sub_location='$sub_location', bhk='$bhk', sq='$sq',comm_type='$comm_type',
            pro_type='$pro_type',pro_cat='$pro_cat', status='$status',pro_name='$pro_name', pro_full_ads='$pro_full_ads', description='$description',
            details='$details', amenities='$amenities', payment_plan='$payment_plan', floor_plan='$new_floor_plan',loc_map='$loc_map',pro_overview='$pro_overview',
            specification='$specification',video_link='$video_link',company='$company',area='$area',
            brochure='$folder_bro', cr_date='$cr_date', image='$file',min_price='$min_price',max_price='$max_price' WHERE id='$id'"); 
            
            }
            else
            {
                $update=$obj->query("UPDATE property SET location='$location', sub_location='$sub_location', bhk='$bhk',sq='$sq',comm_type='$comm_type', 
                pro_type='$pro_type',pro_cat='$pro_cat', status='$status',pro_name='$pro_name', pro_full_ads='$pro_full_ads', description='$description',
                details='$details', payment_plan='$payment_plan', floor_plan='$new_floor_plan',loc_map='$loc_map',pro_overview='$pro_overview',
                specification='$specification',video_link='$video_link',company='$company',area='$area',
                brochure='$folder_bro', cr_date='$cr_date', image='$file',min_price='$min_price',max_price='$max_price' WHERE id='$id'");
            }
            
            
            
            if($update)
            {
                echo '<p class="alert alert-success mt-3"><i class="fa fa-check-square-o" aria-hidden="true"></i> Property Updated Successfully</p>';
            }
            else
            {
                echo '<p class="alert alert-danger mt-3"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> Error Something Wrong</p>';
            }
           
        }
        else
        {
            if(!empty($_POST['ameniti_aprt']))
	        {
	            $up=$obj->query("UPDATE property SET  ameniti_aprt='$ameniti_aprt' WHERE id='$id'");
	        }
            
            if(!empty($_POST['amenities']))
            {
                $update=$obj->query("UPDATE property SET location='$location', sub_location='$sub_location', bhk='$bhk', sq='$sq',comm_type='$comm_type',
                pro_type='$pro_type',pro_cat='$pro_cat', status='$status',pro_name='$pro_name', pro_full_ads='$pro_full_ads', description='$description',
                details='$details', amenities='$amenities', payment_plan='$payment_plan', floor_plan='$new_floor_plan',loc_map='$loc_map',pro_overview='$pro_overview',
                specification='$specification',video_link='$video_link',company='$company',area='$area',
                brochure='$folder_bro', cr_date='$cr_date',min_price='$min_price',max_price='$max_price' WHERE id='$id'"); 
            
            }
            else
            {
                $update=$obj->query("UPDATE property SET location='$location', sub_location='$sub_location', bhk='$bhk', sq='$sq',comm_type='$comm_type',
                pro_type='$pro_type',pro_cat='$pro_cat', status='$status',pro_name='$pro_name', pro_full_ads='$pro_full_ads', description='$description',
                details='$details', payment_plan='$payment_plan', floor_plan='$new_floor_plan',loc_map='$loc_map',pro_overview='$pro_overview',
                specification='$specification',video_link='$video_link',company='$company',area='$area',
                brochure='$folder_bro', cr_date='$cr_date', image='$file',min_price='$min_price',max_price='$max_price' WHERE id='$id'");
            }
            
            
            if($update)
            {
                echo '<p class="alert alert-success mt-3"><i class="fa fa-check-square-o" aria-hidden="true"></i> Property Updated Successfully</p>';
            }
            else
            {
                echo '<p class="alert alert-danger mt-3"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> Error Something Wrong</p>';
            }
        }


}
else
{
    echo '<p class="alert alert-danger mt-3"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> Please fill all mandatory field</p>';    
}

MMCT - 2023