Soshot/app/Utils/Page.php

38 lines
768 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) {
if (in_array($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;
}
}