MMCT TEAM
Server IP : 111.118.215.189  /  Your IP : 3.145.37.181
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/add_property_form.php
<?php 
include("config.php");
// print_r($_FILES['floor_plan']);
// exit();
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['amenities']) && !empty($_POST['payment_plan']) && !empty($_FILES['floor_plan']['name']) 
&& !empty($_POST['total_item']) && !empty($_POST['min_price']) && !empty($_POST['pro_overview']) && !empty($_POST['company']) 
&& !empty($_POST['area'] && !empty($_FILES['image']['tmp_name']))
)
{
    $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_cat=$_POST['pro_cat'];
    $pro_type=$_POST['pro_type'];
    $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']);
    $pro_overview=base64_encode($_POST['pro_overview']);
    $specification=base64_encode($_POST['specification']);
    
     $video_link=base64_encode($_POST['video_link']);
    $min_price=$_POST['min_price'];
    $max_price=$_POST['max_price'];

    $payment_plan=base64_encode($_POST['payment_plan']);
    $company=$_POST['company'];
     $area=$_POST['area'];
    


   $floor_file=array();
    foreach($_FILES['floor_plan']['name'] as $key=>$val)
    {
            $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;
                $upload_floor=move_uploaded_file($tmp_floor, $folder_floor);
                if($upload_floor)
                {
                    $floor_file[]=$folder_floor;
                }
                else
                {
                    echo '<p class="alert alert-danger mt-3"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i>Image uploading faild</p>';
                }
            }
            else
            {
                echo '<p class="alert alert-danger mt-3"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> Image Format not Supported</p>';
            }
    }
    
    $floor_new=serialize($floor_file);

    $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);
    }



    $t_item=$_POST['total_item'];
    //echo $t_item;
    for($cnt=0;$cnt<$t_item;$cnt++)
    {
        $image=$_FILES['image']['name'][$cnt];
        $allowed = array('gif', 'png', 'jpg','jpeg','webp');
        $ext = pathinfo($image, PATHINFO_EXTENSION);
        if (in_array($ext, $allowed)) 
        {
            $tmp_image=$_FILES['image']['tmp_name'][$cnt];
            $temp=explode(".", $image);
            $newfile=rand(00000000,99999999).'.'.end($temp);
            $folder="images/Products/".$newfile;
            $upload=move_uploaded_file($tmp_image, $folder);
            if($upload)
            {
                $new[]=$folder;
            }
            else
            {
                echo '<p class="alert alert-danger mt-3"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> '.$cnt.' number image uploading faild</p>';
            }
        }
        else
        {
            echo '<p class="alert alert-danger mt-3"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> Image Format not Supported</p>';
        }
    }

    $file=serialize($new);
    $cr_date=date("Y-m-d");

    $insert=$obj->query("INSERT INTO property (location, sub_location, bhk, pro_type,pro_cat, status,pro_name, pro_full_ads, description, details, 
    amenities, payment_plan, floor_plan,loc_map, brochure, cr_date, image,min_price,max_price,pro_overview,specification,video_link,company,area,ameniti_aprt,sq,comm_type) 
    VALUES ('$location', '$sub_location', '$bhk', '$pro_type','$pro_cat', '$status', '$pro_name', '$pro_full_ads',
    '$description', '$details', '$amenities', '$payment_plan', '$floor_new', '$loc_map',
    '$folder_bro','$cr_date','$file','$min_price','$max_price','$pro_overview','$specification','$video_link','$company','$area','$ameniti_aprt','$sq','$comm_type')");

    if($insert)
    {
        echo '<p class="alert alert-success mt-3"><i class="fa fa-check-square-o" aria-hidden="true"></i> Property Added 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