Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save anton21m/8b3c32947c188e348e00d0f27692f7f2 to your computer and use it in GitHub Desktop.
Save anton21m/8b3c32947c188e348e00d0f27692f7f2 to your computer and use it in GitHub Desktop.
<?php session_start(); ?>
<?php echo $_SESSION['token'] .' YY '. $_POST['token'].'<br>';
if ($_SERVER['REQUEST_METHOD'] == 'POST'
&& $_SESSION['token'] == $_POST['token']){
echo '<script>alert("Успех");</script>';
} ?>
<?php $_SESSION['token'] = md5(time()); ?>
<form name="form" method="post" action="test.php">
<input type="text" name="den">
<input type="hidden" name="token" value="<?= $_SESSION['token'] ?>">
<input type="submit" >
<?php echo $_SESSION['token']; ?>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment