43 lines
926 B
PHP
43 lines
926 B
PHP
<?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) {
|
|
if (is_array($attend)) {
|
|
if (in_array($test, $attend)) {
|
|
return 'selected';
|
|
}
|
|
} else {
|
|
if ($test === $attend) {
|
|
return 'selected';
|
|
}
|
|
}
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|