<?php

require_once 'header.php';
$controller = new ControllerAuthentication();
$extras = new Extras();
$authentication_id = $extras->decryptQuery1(KEY_SALT, $_SERVER['QUERY_STRING']);
$user = $controller->getAccessUserByAuthenticationId($authentication_id);
if ($authentication_id != null) {
    if (isset($_POST['submit'])) {
        $itm = new Authentication();
        $itm->authentication_id = $user->authentication_id;
        $itm->name = trim(strip_tags($_POST['name']));
        $itm->username = $user->username;
        $pass = trim(strip_tags($_POST['password']));
        $password_confirm = trim(strip_tags($_POST['password_confirm']));
        $password_current = trim(strip_tags($_POST['password_current']));
        $itm->password = md5($pass);
        if (strlen($pass) < 8) {
            echo "<script >alert('Password field must be atleast 8 alphanumeric characters.');</script>";
        } else {
            if ($user->password != md5($password_current)) {
                echo "<script >alert('Current password does not match.');</script>";
            } else {
                if ($pass != $password_confirm) {
                    echo "<script >alert('Password does not match.');</script>";
                } else {
                    $controller->updateAccessUser($itm);
                    echo "<script type='text/javascript'>location.href='admin_access.php';</script>";
                }
            }
        }
<?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>";
}
?>
Exemplo n.º 3
0
<?php

require_once 'header.php';
$controller = new ControllerCategory();
$extras = new Extras();
$category_id = $extras->decryptQuery1(KEY_SALT, $_SERVER['QUERY_STRING']);
if ($category_id != null) {
    $category = $controller->getCategoryByCategoryId($category_id);
    if (isset($_POST['submit'])) {
        $itm = new Category();
        $itm->category_id = $category_id;
        $itm->category = trim(strip_tags($_POST['category']));
        $itm->created_at = time();
        $itm->updated_at = time();
        $itm->category_icon = $_POST['category_icon'];
        $count = count($_FILES["file"]["name"]);
        if (!empty($_FILES["file"]["name"][0])) {
            uploadFile($controller, $itm);
        } else {
            $controller->updateCategory($itm);
            echo "<script type='text/javascript'>location.href='categories.php';</script>";
        }
    }
} else {
    echo "<script type='text/javascript'>location.href='403.php';</script>";
}
function uploadFile($controller, $itm)
{
    $extras = new Extras();
    $desired_dir = Constants::IMAGE_UPLOAD_DIR;
    $errors = array();
Exemplo n.º 4
0
<?php

require_once 'header.php';
$controller = new ControllerAgent();
$agents = $controller->getAgents();
if (!empty($_SERVER['QUERY_STRING'])) {
    $extras = new Extras();
    $agent_id = $extras->decryptQuery1(KEY_SALT, $_SERVER['QUERY_STRING']);
    if ($agent_id != null) {
        $controller->deleteAgent($agent_id, 1);
        echo "<script type='text/javascript'>location.href='agents.php';</script>";
    } else {
        echo "<script type='text/javascript'>location.href='403.php';</script>";
    }
}
$search_criteria = "";
if (isset($_POST['button_search'])) {
    $search_criteria = trim(strip_tags($_POST['search']));
    $agents = $controller->getAgentsBySearching($search_criteria);
}
?>


<!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="">
<?php

require_once 'header.php';
$controller = new ControllerPropertyType();
$propertytypes = $controller->getPropertyTypes();
if (!empty($_SERVER['QUERY_STRING'])) {
    $extras = new Extras();
    $propertytype_id = $extras->decryptQuery1(KEY_SALT, $_SERVER['QUERY_STRING']);
    if ($propertytype_id != null) {
        $controller->deletePropertyType($propertytype_id, 1);
        echo "<script type='text/javascript'>location.href='propertytypes.php';</script>";
    } else {
        echo "<script type='text/javascript'>location.href='403.php';</script>";
    }
}
$search_criteria = "";
if (isset($_POST['button_search'])) {
    $search_criteria = trim(strip_tags($_POST['search']));
    $propertytypes = $controller->getPropertyTypesBySearching($search_criteria);
}
?>


<!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="">