2024-04-28 17:37:00 +02:00
|
|
|
<?php
|
2024-05-04 23:02:24 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Object to store info about logged in user
|
|
|
|
*/
|
|
|
|
class User
|
|
|
|
{
|
|
|
|
public $user_id;
|
|
|
|
public $user_name;
|
|
|
|
public $email;
|
|
|
|
public $permissions;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor for the User.
|
|
|
|
*/
|
|
|
|
public function __construct($userId, $username, $email, $permissions) {
|
|
|
|
$this->user_id = $userId;
|
|
|
|
$this->user_name = $username;
|
|
|
|
$this->email = $email;
|
|
|
|
$this->permissions = $permissions;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-28 17:37:00 +02:00
|
|
|
/**
|
|
|
|
* Sanitize a given input string to be safe to display and process.
|
|
|
|
*/
|
|
|
|
function sanitize_input($data) {
|
|
|
|
// Remove unnecessary whitespace characters
|
|
|
|
$data = trim($data);
|
|
|
|
// Remove backslashes
|
|
|
|
$data = stripslashes($data);
|
|
|
|
// Escape all special characters to HTML entities
|
|
|
|
$data = htmlspecialchars($data);
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|