<?php

require_once 'header.php';
$controller = new ControllerRealEstate();
$controllerAgent = new ControllerAgent();
$controllerPropertyType = new ControllerPropertyType();
$agents = $controllerAgent->getAgents();
$propertytypes = $controllerPropertyType->getPropertyTypes();
$extras = new Extras();
if (isset($_POST['submit'])) {
    $itm = new RealEstate();
    $itm->address = htmlspecialchars(trim(strip_tags($_POST['address'])), ENT_QUOTES);
    $itm->baths = htmlspecialchars(trim(strip_tags($_POST['baths'])), ENT_QUOTES);
    $itm->beds = trim(strip_tags($_POST['beds']));
    $itm->built_in = trim(strip_tags($_POST['built_in']));
    $itm->country = htmlspecialchars(trim(strip_tags($_POST['country'])), ENT_QUOTES);
    $itm->created_at = time();
    $itm->desc1 = $extras->removeHttp(htmlspecialchars(trim(strip_tags($_POST['desc1'])), ENT_QUOTES));
    $itm->featured = htmlspecialchars(trim(strip_tags($_POST['featured'])), ENT_QUOTES);
    $itm->lat = trim(strip_tags($_POST['lat']));
    $itm->lon = trim(strip_tags($_POST['lon']));
    $itm->lot_size = trim(strip_tags($_POST['lot_size']));
    $itm->price = htmlspecialchars(trim(strip_tags($_POST['price'])), ENT_QUOTES);
    $itm->price_per_sqft = htmlspecialchars(trim(strip_tags($_POST['price_per_sqft'])), ENT_QUOTES);
    $itm->property_type = trim(strip_tags($_POST['property_type']));
    $itm->rooms = trim(strip_tags($_POST['rooms']));
    $itm->sqft = trim(strip_tags($_POST['sqft']));
    $itm->status = trim(strip_tags($_POST['status']));
    $itm->updated_at = time();
    $itm->is_deleted = 0;
    $itm->agent_id = trim(strip_tags($_POST['agent_id']));
<?php

require_once 'header.php';
$controller = new ControllerPhoto();
$controllerRealEstate = new ControllerRealEstate();
$realestates = $controllerRealEstate->getRealEstates();
$extras = new Extras();
$realestate_id = $extras->decryptQuery1(KEY_SALT, $_SERVER['QUERY_STRING']);
$backUrl = $extras->encryptQuery1(KEY_SALT, 'realestate_id', $realestate_id, 'photo_realestate_view.php');
if (isset($_POST['url_upload'])) {
    $itm = new Photo();
    $itm->photo_url = trim($_POST['photo_url']);
    $itm->thumb_url = trim($_POST['thumb_url']);
    $itm->realestate_id = $realestate_id;
    $itm->created_at = time();
    $itm->updated_at = time();
    $controller->insertPhoto($itm);
    echo "<script type='text/javascript'>location.href='{$backUrl}';</script>";
}
if (isset($_POST['file_upload'])) {
    $count = count($_FILES["file"]["name"]);
    if (!empty($_FILES["file"]["name"][0]) && !empty($_FILES["file"]["name"][1])) {
        uploadFile($controller, $realestate_id);
    } else {
        echo "<script>alert('You must provide both Photo and Thumbnail file.');</script>";
    }
}
if ($realestate_id == null) {
    echo "<script type='text/javascript'>location.href='403.php';</script>";
}
?>
<?php

require_once 'header.php';
$controller = new ControllerRealEstate();
$controllerAgent = new ControllerAgent();
$controllerPropertyType = new ControllerPropertyType();
$agents = $controllerAgent->getAgents();
$propertytypes = $controllerPropertyType->getPropertyTypes();
$extras = new Extras();
$realestate_id = $extras->decryptQuery1(KEY_SALT, $_SERVER['QUERY_STRING']);
if ($realestate_id != null) {
    $realestate = $controller->getRealEstateByRealEstateId($realestate_id);
    if (isset($_POST['submit'])) {
        $itm = $realestate;
        $itm->address = htmlspecialchars(trim(strip_tags($_POST['address'])), ENT_QUOTES);
        $itm->baths = htmlspecialchars(trim(strip_tags($_POST['baths'])), ENT_QUOTES);
        $itm->beds = trim(strip_tags($_POST['beds']));
        $itm->built_in = trim(strip_tags($_POST['built_in']));
        $itm->country = htmlspecialchars(trim(strip_tags($_POST['country'])), ENT_QUOTES);
        $itm->desc1 = $extras->removeHttp(htmlspecialchars(trim(strip_tags($_POST['desc1'])), ENT_QUOTES));
        $itm->featured = htmlspecialchars(trim(strip_tags($_POST['featured'])), ENT_QUOTES);
        $itm->lat = trim(strip_tags($_POST['lat']));
        $itm->lon = trim(strip_tags($_POST['lon']));
        $itm->lot_size = trim(strip_tags($_POST['lot_size']));
        $itm->price = htmlspecialchars(trim(strip_tags($_POST['price'])), ENT_QUOTES);
        $itm->price_per_sqft = htmlspecialchars(trim(strip_tags($_POST['price_per_sqft'])), ENT_QUOTES);
        $itm->property_type = trim(strip_tags($_POST['property_type']));
        $itm->rooms = trim(strip_tags($_POST['rooms']));
        $itm->sqft = trim(strip_tags($_POST['sqft']));
        $itm->status = trim(strip_tags($_POST['status']));
        $itm->updated_at = time();
<?php

require_once 'header.php';
$controller = new ControllerRealEstate();
$controllerPhoto = new ControllerPhoto();
$realestates = $controller->getRealEstates();
if (!empty($_SERVER['QUERY_STRING'])) {
    $extras = new Extras();
    $realestate_id = $extras->decryptQuery1(KEY_SALT, $_SERVER['QUERY_STRING']);
    $realestate_id_featured = $extras->decryptQuery2(KEY_SALT, $_SERVER['QUERY_STRING']);
    if ($realestate_id != null) {
        $controller->deleteRealEstate($realestate_id, 1);
        echo "<script type='text/javascript'>location.href='realestates.php';</script>";
    }
    if ($realestate_id_featured != null) {
        $itm = new RealEstate();
        $itm->realestate_id = $realestate_id_featured[0];
        $itm->featured = $realestate_id_featured[1] == "yes" ? 0 : 1;
        $res = $controller->updateRealEstateFeatured($itm);
        echo "<script type='text/javascript'>location.href='realestates.php';</script>";
    }
    if ($realestate_id_featured == null && $realestate_id == null) {
        echo "<script type='text/javascript'>location.href='403.php';</script>";
    }
}
$search_criteria = "";
if (isset($_POST['button_search'])) {
    $search_criteria = trim(strip_tags($_POST['search']));
    $realestates = $controller->getRealEstatesBySearching($search_criteria);
}
?>
Example #5
0
<?php

require_once 'header.php';
$controller = new ControllerRealEstate();
$realestates = $controller->getRealEstateFeatured();
?>


<!DOCTYPE html>
<html lang="en"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="shortcut icon" href="http://getbootstrap.com/assets/ico/favicon.ico">

    <title>RealEstate Finder</title>

    <!-- Bootstrap core CSS -->
    <link href="bootstrap/css/bootstrap.css" rel="stylesheet">
    <!-- Custom styles for this template -->
    <link href="bootstrap/css/navbar-fixed-top.css" rel="stylesheet">
    <link href="bootstrap/css/custom.css" rel="stylesheet">


    <!-- Just for debugging purposes. Don't actually copy this line! -->
    <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<?php

require_once 'header.php';
$controller = new ControllerPhoto();
$controllerRealEstate = new ControllerRealEstate();
$extras = new Extras();
$realestate_id = $extras->decryptQuery1(KEY_SALT, $_SERVER['QUERY_STRING']);
$photo_realestate_delete = $extras->decryptQuery2(KEY_SALT, $_SERVER['QUERY_STRING']);
if ($realestate_id != null) {
    $photos_realestate = $controller->getPhotosByRealEstateId($realestate_id);
    $selected_realestate = $controllerRealEstate->getRealEstateByRealEstateId($realestate_id);
}
if ($photo_realestate_delete != null) {
    $realestate_id = $photo_realestate_delete[0];
    $photo_id = $photo_realestate_delete[1];
    $controller->deletePhoto($photo_id, 1);
    $viewUrl = $extras->encryptQuery1(KEY_SALT, 'realestate_id', $realestate_id, 'photo_realestate_view.php');
    echo "<script type='text/javascript'>location.href='{$viewUrl}';</script>";
}
if ($realestate_id == null && $photo_realestate_delete == null) {
    echo "<script type='text/javascript'>location.href='403.php';</script>";
}
?>


<!DOCTYPE html>
<html lang="en"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
<?php

require_once '../header_rest.php';
$controllerRealEstate = new ControllerRealEstate();
$controllerUser = new ControllerUser();
if (!empty($_POST['login_hash'])) {
    $login_hash = $_POST['login_hash'];
}
if (!empty($_POST['user_id'])) {
    $user_id = $_POST['user_id'];
}
if (!empty($_POST['address'])) {
    $address = $_POST['address'];
}
if (!empty($_POST['agent_id'])) {
    $agent_id = $_POST['agent_id'];
}
$baths = "";
if (!empty($_POST['baths'])) {
    $baths = $_POST['baths'];
}
$beds = "";
if (!empty($_POST['beds'])) {
    $beds = trim(strip_tags($_POST['beds']));
}
$built_in = 0;
if (!empty($_POST['built_in'])) {
    $built_in = trim(strip_tags($_POST['built_in']));
}
$country = "";
if (!empty($_POST['country'])) {