<?php
class csrf
{
protected $hash = '';
public function __construct ()
{
$hash = $this->getHash();
}
public function getHash ()
{
}
public function check ()
{
if (isset($_COOKIE['csrf_test'], $_POST['csrf_test'])) {
if ($_COOKIE['csrf_test'] != $_POST['csrf_test'])
{
exit('CSRF PTOTECTED: иди на хуй'); }
}
else
{
exit('CSRF PTOTECTED: иди на хуй'); }
}
public function hidden ()
{
return '<input type="hidden" name="csrf_test" value="'.$this->hash.'">'; }
public function _check ()
{
if (isset($_COOKIE['csrf_test'], $_GET['csrf_test'])) {
if ($_COOKIE['csrf_test'] != $_GET['csrf_test'])
{
exit('CSRF PTOTECTED: иди на хуй'); }
}
else
{
exit('CSRF PTOTECTED: иди на хуй'); }
}
}
?>