Exemple #1
0
<?php

session_start();
require 'UsersDatabase.php';
require 'PropertiesDatabase.php';
// Connection to the database
$propertiesDatabase = new PropertiesDatabase('data/properties.json');
if (isset($_SESSION['username'])) {
    $toBuyPropertyId = $_GET['propertyId'];
    $buyerUsername = $_GET['buyer'];
    if (!$propertiesDatabase->isSold($toBuyPropertyId)) {
        $propertiesDatabase->update($toBuyPropertyId, 'sold', true);
        $propertiesDatabase->update($toBuyPropertyId, 'buyer', $buyerUsername);
        $_SESSION['buyingConfirmation'] = "Property successfully purchased!";
    }
}
header("Location: index.php");
Exemple #2
0
<?php

session_start();
require 'JSONStream.php';
require 'PropertiesDatabase.php';
require 'helpers/adminManager.php';
if (isset($_SESSION['username'])) {
    $propertiesDatabase = new PropertiesDatabase('data/properties.json');
    $propertyData = array('name' => $_POST['name'], 'location' => $_POST['location'], 'price' => $_POST['price']);
    $propertiesDatabase->addNew($propertyData['price'], $propertyData['name'], $_SESSION['username'], $propertyData['location']);
} else {
    echo "Unauthorized access";
}
Exemple #3
0
<?php

require 'UsersDatabase.php';
require 'PropertiesDatabase.php';
require 'helpers/adminManager.php';
session_start();
// Array to store login errors if they occur
$loginerrors = isset($_SESSION['loginerrors']) ? $_SESSION['loginerrors'] : [];
$fields = isset($_SESSION['fields']) ? $_SESSION['fields'] : [];
// Database connections
$usersData = new UsersDatabase('data/users.json');
$propertiesData = new PropertiesDatabase('data/properties.json');
if (isset($_SESSION['username'])) {
    $username = $_SESSION['username'];
    $name = $usersData->userFullName($username);
    $properties = $propertiesData->buyableProperties($username);
}
?>

<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>100Acres - Buy Sell Properties</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">
Exemple #4
0
<?php

session_start();
require 'helpers/adminManager.php';
require 'PropertiesDatabase.php';
require 'UsersDatabase.php';
$error;
if (isset($_SESSION['username']) && isAdmin($_SESSION['username'])) {
    $propertiesDatabase = new PropertiesDatabase('data/properties.json');
    $usersDatabase = new UsersDatabase('data/users.json');
    $allProperties = $propertiesDatabase->dataArray();
    $soldProperties = $propertiesDatabase->soldProperties();
    $unsoldProperties = $propertiesDatabase->unsoldProperties();
} else {
    // unauthorised accces
    $error = "You are not authorized to access this content, please login with an admin account.";
}
?>

<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>Sales Report</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">