Example #1
0
$r_values['Phone'] = "";
$r_values['Mail'] = "";
extract($r_values);
if (isset($_POST['join'])) {
    foreach ($_POST as $key => $value) {
        $value = pure_it($value);
        empty($value) ? $r_missing = "Please fill out all the fields!" : (${$key} = $value);
    }
    if (!$r_missing) {
        // Email Validation:
        $Invalid_Mail = validate_email($Mail, $r_error);
        // Checking if Email Already Registered:
        $Email_Exist = isEmailExist($Mail, 'userids', $r_error);
        // Checking if Email Exist in the Request Queue:
        if (!$Email_Exist) {
            $Email_Exist = isEmailExist($Mail, 'userids_temp', $r_error);
            $Email_Exist = $Email_Exist ? "We already have this email in pending request" : "";
        }
        // Checking if Student ID Registered:
        $StudentID = strtoupper($StudentID);
        $StudentID_Exist = isStudentIDExist($StudentID, 'userids', $r_error);
        // Checking if Student ID Exist in the Request Queue:
        if (!$StudentID_Exist) {
            $StudentID_Exist = isStudentIDExist($StudentID, 'userids_temp', $r_error);
            $StudentID_Exist = $StudentID_Exist ? "We already have this ID in pending request" : "";
        }
        // Checking if File Size Exceded Limit:
        $ImageSize_err = validate_image_size($_FILES["Image"]["size"], $r_error);
        // Checking if the File is Invalid:
        $ImageType_err = validate_image_type($_FILES["Image"]["type"], $r_error);
        // Checking if the Student is from Dept. of CSE:
Example #2
0
if (isset($_POST['Update_Info'])) {
    foreach ($_POST as $key => $value) {
        $value = pure_it($value);
        if (!in_array($key, $u_optional)) {
            empty($value) ? $u_missing = "Please fill out all the fields marked with an (*) asterisk!" : (${$key} = $value);
        } else {
            ${$key} = $value;
        }
    }
    if (!$u_missing) {
        if (!empty($Mail) && $Member->getEmail() != $Mail) {
            // Email Validation:
            $Invalid_Mail = validate_email($Mail, $error);
            if (!$Invalid_Mail) {
                // Checking if Email Exist:
                $Email_Exist = isEmailExist($Mail, $error);
            }
        }
        if ($_FILES["Image"]["size"]) {
            // Checking if File Size Exceded Limit:
            $ImageSize_err = validate_image_size($_FILES["Image"]["size"], $error);
            // Checking if the File is Invalid:
            $ImageType_err = validate_image_type($_FILES["Image"]["type"], $error);
        }
        if ($OLD_PWD) {
            // Password Check:
            $Invalid_Pass = passwordMatch($_SESSION['user_id'], ROT13($OLD_PWD), $error);
            // Password Match Check:
            if (!empty($OLD_PWD) && !$Invalid_Pass) {
                $Miss_Match = $NEW_PWD == $RE_PWD ? "" : "Password doesn't match!";
                $error = $Miss_Match ? true : false;