token support, api fixes and security, dark mode

This commit is contained in:
Joey Kimsey
2024-12-07 01:58:27 -05:00
parent b93d0259e4
commit 485d85cb0a
26 changed files with 934 additions and 85 deletions

View File

@ -88,4 +88,18 @@ function iv( $variable ) {
echo '<pre>';
echo var_export( $variable, true );
echo '</pre>';
}
function generateToken(): string {
return bin2hex(random_bytes(32)); // Generates a 64-character hexadecimal token
}
function generateRandomString( $length = 10 ) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen( $characters );
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[random_int(0, $charactersLength - 1)];
}
return $randomString;
}