Soshot/app/Utils/Page.php

37 lines
768 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 (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;
}
}