function form_validation($uname, $pwd, $email, $dob, $sex, $state, $city, $news)
{
    $error_message = "";
    $error_message = validate_username($uname, $error_message);
    $error_message = validate_password($pwd, $error_message);
    $error_message = validate_email($email, $error_message);
    $error_message = validate_dob($dob, $error_message);
    $error_message = validate_sex($sex, $error_message);
    $error_message = validate_state($state, $error_message);
    $error_message = validate_city($city, $error_message);
    $error_message = validate_newsletter($news, $error_message);
    if ($error_message) {
        echo "<br>I am sorry, but you haven't filled the form correctly. Please check the following.<br><br>" . $error_message;
        // echo "I am now redirecting you to the previous page. Please fill it correctly this time.";
        // header ( "Location: ../Client/signup.html" );
        return 0;
    } else {
        return 1;
    }
}
Ejemplo n.º 2
0
function Validate_Request()
{
    global $persistent;
    unset($errors);
    foreach ($_REQUEST as $key => $val) {
        switch ($key) {
            case "first_name":
                if (validate_first_name($val)) {
                    $persistent[$key] = $val;
                } else {
                    $persistent[$key] = "";
                }
                break;
            case "last_name":
                if (validate_last_name($val)) {
                    $persistent[$key] = $val;
                } else {
                    $persistent[$key] = "";
                }
                break;
            case "ID":
                if (validate_ID($val)) {
                    $persistent[$key] = $val;
                } else {
                    $persistent[$key] = "";
                }
                break;
            case "user_name":
                if (validate_user_name($val)) {
                    if (!checkIfUserNameExsists($val)) {
                        $persistent[$key] = $val;
                    } else {
                        $persistent[$key] = "";
                    }
                } else {
                    $persistent[$key] = "";
                }
                break;
            case "pass1":
                if (validate_pass1($val)) {
                    $persistent[$key] = $val;
                } else {
                    $persistent[$key] = "";
                }
                break;
            case "pass2":
                if (validate_pass2($val)) {
                    $persistent[$key] = $val;
                } else {
                    $persistent[$key] = "";
                }
                break;
            case "email":
                if (validate_email($val)) {
                    $persistent[$key] = $val;
                } else {
                    $persistent[$key] = "";
                }
                break;
            case "year_of_birth":
                if (validate_YearOfBirth($val)) {
                    $persistent[$key] = $val;
                } else {
                    $persistent[$key] = "";
                }
                break;
            case "phone":
                if (validate_Phone($val)) {
                    $persistent[$key] = $val;
                } else {
                    $persistent[$key] = "";
                }
                break;
            case "cell_phone":
                if (validate_CellPhone($val)) {
                    $persistent[$key] = $val;
                } else {
                    $persistent[$key] = "";
                }
                break;
            case "city":
                if (validate_city($val)) {
                    $persistent[$key] = $val;
                } else {
                    $persistent[$key] = "";
                }
                break;
            case "street":
                if (validate_street($val)) {
                    $persistent[$key] = $val;
                } else {
                    $persistent[$key] = "";
                }
                break;
            case "house_number":
                if (validate_houseNumber($val)) {
                    $persistent[$key] = $val;
                } else {
                    $persistent[$key] = "";
                }
                break;
            case "father_name":
                if (validate_father_name($val)) {
                    $persistent[$key] = $val;
                } else {
                    $persistent[$key] = "";
                }
                break;
            case "mother_name":
                if (validate_mother_name($val)) {
                    $persistent[$key] = $val;
                } else {
                    $persistent[$key] = "";
                }
                break;
            case "father_phone":
                if (validate_father_CellPhone($val)) {
                    $persistent[$key] = $val;
                } else {
                    $persistent[$key] = "";
                }
                break;
            case "mother_phone":
                if (validate_mother_CellPhone($val)) {
                    $persistent[$key] = $val;
                } else {
                    $persistent[$key] = "";
                }
                break;
            case "memberOfGroup":
                $persistent[$key] = $val;
                break;
            case "year_of_birth":
                $persistent[$key] = $val;
                break;
            case "month_of_birth":
                $persistent[$key] = $val;
                break;
            case "day_of_birth":
                $persistent[$key] = $val;
                break;
        }
    }
}
Ejemplo n.º 3
0
     }
 }
 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'];
             }
             if (isset($_POST['furnished']) && $_POST['furnished'] == 'on') {
Ejemplo n.º 4
0
 if ($pay_max == $pay_min) {
     $payment = "{$currency} {$pay_max} <span class='payment-rule'>{$payment_rule}</span>";
 }
 //if payment is NEG
 if ($pay_max == 0 && $pay_min == 0) {
     $payment = "Negotiable";
 }
 $input = ["title" => $jobtitle, "location" => $job_location, "payment" => $payment, "url" => $jobtitle_clean_url, "country" => $job_country, "jnum" => $job_number];
 $correct_result = true;
 /*---------------Country---------------*/
 if (isset($u_country) && $u_country !== "") {
     validate_country();
 }
 /*---------------City---------------*/
 if (isset($u_city) && $u_city !== "") {
     validate_city();
 }
 /*---------------Title---------------*/
 if (isset($u_jobtitle) && $u_jobtitle !== "") {
     validate_title();
 }
 /*---------------Category---------------*/
 if (isset($u_category) && $u_category !== "Industry" && $u_category !== "") {
     validate_category();
 }
 /*---------------Location---------------*/
 if (isset($u_location) && $u_location !== "Location" && $u_location !== "") {
     validate_location();
 }
 /*---------------keywords---------------*/
 if (isset($u_keywords) && $u_keywords !== "") {
Ejemplo n.º 5
0
include 'validate.php';
include 'database.php';
// Assign POST data
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$address1 = $_POST['address1'];
$address2 = $_POST['address2'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$country = $_POST['country'];
// Validate POST data
$b_is_first_name_valid = validate_string($first_name);
$b_is_last_name_valid = validate_string($last_name);
$b_is_address_valid = validate_address($address1, $address2);
$b_is_city_valid = validate_city($city);
$b_is_state_valid = validate_string($state);
$b_is_zip_valid = validate_zip($zip);
$b_is_country_valid = validate_string($country);
// Verify required fields have been populated with valid input.
if ($b_is_first_name_valid == true && $b_is_last_name_valid == true && $b_is_address_valid == true && $b_is_city_valid == true && $b_is_state_valid == true && $b_is_zip_valid == true && $b_is_country_valid == true) {
    // Create array of data to submit.
    $data = array('first_name' => $first_name, 'last_name' => $last_name, 'address1' => $address1, 'address2' => $address2, 'city' => $city, 'state' => $state, 'zip' => $zip, 'country' => $country);
    // Submit data to database.
    $b_rc = submit_to_database($data);
    if ($b_rc == true) {
        // Print html and body tags.
        echo "<html>\n";
        echo "<body>\n";
        // Show registration confirmation message.
        echo "Thanks for registering!<br>\n";