Soshot/app/Utils/Page.php

44 lines
926 B
PHP
Raw Normal View History

2023-06-21 11:42:36 +02:00
<?php
namespace App\Utils;
class Page {
static function active($test, $attend, $class) {
if ($test === $attend) {
return $class;
}
}
static function checked($test, $attend) {
if ($test === $attend) {
return 'checked';
}
}
static function selected($test, $attend) {
2023-06-28 12:29:20 +02:00
if (is_array($attend)) {
if (in_array($test, $attend)) {
return 'selected';
}
} else {
if ($test === $attend) {
return 'selected';
}
2023-06-21 11:42:36 +02:00
}
}
static function genToken() {
$token = sha1(uniqid(rand(), true) . '_' . mt_rand());
$_SESSION['token'] = $token;
return $token;
}
static function verifToken($token) {
if ($token === $_SESSION['token']) {
return true;
}
return false;
}
}