Files
woordjes/includes/functions.php
T
2026-06-15 09:36:18 +02:00

32 lines
468 B
PHP

<?php
declare(strict_types=1);
function sanitize(string $value): string
{
return htmlspecialchars(
trim($value),
ENT_QUOTES,
'UTF-8'
);
}
function usernameToFolder(
string $username
): string {
return preg_replace(
'/[^a-zA-Z0-9_-]/',
'',
strtolower($username)
);
}
function userPath(
string $username
): string {
return USERS_PATH .
'/' .
usernameToFolder($username);
}