Пример #1
0
function changePassword($loggedUser)
{
    if (isset($_POST[oldPassWOrd])) {
        echo "<hr>";
        print_r($_POST);
        print_r($loggedUser);
        echo "<hr>";
        echo $loggedUser->getUname();
        echo "<hr>";
        if ($loggedUser->getPasswd() == md5($_POST[oldPassWOrd])) {
            if ($_POST["passwd"] == $_POST["passwdConf"]) {
                if (validate_pass1($_POST["passwd"])) {
                    $hash_passwd = md5($_POST["passwd"]);
                } else {
                    return FALSE;
                }
            }
            $sql = "UPDATE users SET Password='******' Where Username='******'";
            printSqlQuary($sql);
            executeQuary($sql);
        }
    }
}
Пример #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;
        }
    }
}
Пример #3
0
 function login()
 {
     if (validate_user_name($_POST["uname"])) {
         $uname = $_POST["uname"];
     } else {
         return FALSE;
     }
     if (validate_pass1($_POST["passwd"])) {
         $hash_passwd = md5($_POST["passwd"]);
     } else {
         return FALSE;
     }
     $sql = "SELECT username, Password FROM USERS where username = '******' AND Password='******'";
     $result = executeQuary($sql);
     if ($myRecord = mysql_fetch_array($result)) {
         if ($uname == $myRecord['username'] && $hash_passwd == $myRecord['Password']) {
             $this->setUname($uname);
             $tmpPassArr[1] = $_POST["passwd"];
             $tmpPassArr[2] = $_POST["passwd"];
             $this->setPasswd($tmpPassArr);
             $this->getUserDetails();
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }