Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Class Security
- {
- public static function getToken()
- {
- $token = sha1(uniqid());
- $_SESSION['token'] = $token;
- return $_SESSION['token'];
- }
- public static function checkToken($token)
- {
- if (isset($_SESSION['token'])) {
- if ($token == $_SESSION['token']) {
- unset($_SESSION['token']);
- return true;
- }
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement