42 lines
877 B
PHP
42 lines
877 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
function isEmpty(array $array){
|
|
foreach ($array as $value => $content) {
|
|
if (empty($content)){
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|
|
function does_Password_match(object $pdo, string $username, string $pwd) {
|
|
// Get hashed password from db
|
|
function get_hashed_password(object $pdo, string $username) {
|
|
$stored_pwd = retrieve_hashed_pwd($pdo, $username);
|
|
|
|
return $stored_pwd;
|
|
}
|
|
|
|
$stored_pwd = get_hashed_password($pdo, $username);
|
|
|
|
if (password_verify($pwd,$stored_pwd)) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
function does_user_exist(object $pdo, string $username){
|
|
if (search_user($pdo, $username)){
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
function print_errors(){
|
|
check_errors();
|
|
} |