Transfer to git
This commit is contained in:
43
includes/chat_send_contr.inc.php
Normal file
43
includes/chat_send_contr.inc.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
function isEmpty(array $array){
|
||||
foreach ($array as $value => $content) {
|
||||
if (empty($content)){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function user_exists(object $pdo, string $username){
|
||||
if (username_search($pdo, $username)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function send_message(object $pdo, string $username, string $content) {
|
||||
function get_users_id(object $pdo, string $username){
|
||||
$user_id = retrieve_user_id($pdo, $username);
|
||||
return $user_id;
|
||||
}
|
||||
|
||||
$users_id = get_users_id($pdo, $username);
|
||||
write_message($pdo, $username, $users_id, $content);
|
||||
}
|
||||
|
||||
function print_errors(){
|
||||
check_errors();
|
||||
}
|
||||
|
||||
function is_user_logged_in() {
|
||||
if (isset($_SESSION["username"])) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user