示例#1
0
文件: add.php 项目: jlgaffney/Group14
         $canAdd = true;
     }
 }
 if ($canAdd) {
     // Check that user can add a property
     $errors = array();
     // Check if post values are set. If false, user has opened page the first time
     if (isset($_POST['owner']) || isset($_POST['buildingNo']) || isset($_POST['street']) || isset($_POST['suburb']) || isset($_POST['city']) || isset($_POST['state']) || isset($_POST['postcode']) || isset($_POST['type']) || isset($_POST['rent']) || isset($_POST['bed']) || isset($_POST['furnished']) || isset($_POST['description'])) {
         require $relative . 'data/php/user/validate.inc';
         if (!isset($_POST['owner']) || $_POST['owner'] == '') {
             $errors['owner'] = 'Please select an owner';
         }
         // Validate property details
         validate_buildingNo($errors, $_POST['buildingNo']);
         validate_rent($errors, $_POST['rent']);
         validate_suburb($errors, $_POST['suburb']);
         validate_city($errors, $_POST['city']);
         validate_state($errors, $_POST['state']);
         validate_bed($errors, $_POST['bed']);
         validate_postcode($errors, $_POST['postcode']);
         validate_street($errors, $_POST['street']);
         validate_description($errors, $_POST['description']);
         validate_rules($errors, $_POST['rules']);
         if (!isset($errors['owner']) && !isset($errors['buildingNo']) && !isset($errors['street']) && !isset($errors['suburb']) && !isset($errors['city']) && !isset($errors['state']) && !isset($errors['postcode']) && !isset($errors['type']) && !isset($errors['rent']) && !isset($errors['bed']) && !isset($errors['furnished']) && !isset($errors['description']) && !isset($errors['apartmentNo']) && !isset($errors['bath']) && !isset($errors['rules'])) {
             // form is valid
             $owner = $_POST['owner'];
             // Set optional fields if required
             $rules = null;
             if (isset($_POST['rules'])) {
                 $rules = $_POST['rules'];
             }
示例#2
0
		<div id="wrapper">
			<?php 
require $relative . 'data/php/site/header-menu.inc';
?>
			<!-- MAIN CONTENT STARTS -->
			<div id="centredDiv">
				<h1>Search</h1>
				<?php 
$errors = array();
// Check if any search values are set. If false, user has opened page the first time
if (isset($_GET['rentMin']) && $_GET['rentMin'] != '' || isset($_GET['rentMax']) && $_GET['rentMax'] != '' || isset($_GET['suburb']) && $_GET['suburb'] != '' || isset($_GET['bedrooms']) && $_GET['bedrooms'] != '' || isset($_GET['bathrooms']) && $_GET['bathrooms'] != '' || isset($_GET['type']) && $_GET['type'] != '' || isset($_GET['furnished'])) {
    // Validate fields
    require $relative . 'data/php/search/validate.inc';
    validate_rentMin($errors, $_GET['rentMin']);
    validate_rentMax($errors, $_GET['rentMax']);
    validate_suburb($errors, $_GET['suburb']);
    validate_bedrooms($errors, $_GET['bedrooms']);
    validate_bathrooms($errors, $_GET['bathrooms']);
    if (!isset($errors['rentMin']) && !isset($errors['rentMax']) && !isset($errors['suburb']) && !isset($errors['bedrooms']) && !isset($errors['bathrooms'])) {
        // Fields are valid
        require $relative . 'data/php/database/pdo.inc';
        echo searchProperties($_GET['furnished'], $_GET['rentMin'], $_GET['rentMax'], $_GET['suburb'], $_GET['bedrooms'], $_GET['bathrooms'], $_GET['type']);
    } else {
        // Some fields are invalid
        include $relative . 'data/php/search/search.inc';
        // Display errors
    }
} else {
    include $relative . 'data/php/search/search.inc';
}
?>