예제 #1
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;
        }
    }
}
예제 #2
0
 private function setPhone($phone)
 {
     $this->phone = validate_Phone($phone) ? $phone : "";
 }