Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- if (isset($_POST['uname'], $_POST['token'])) {
- if (!empty($_POST['uname']) && !empty($_POST['token'])) {
- if (!Security::checkToken($_POST['uname'])) {
- // Show the error or redirect on home page!
- header('Location: index.php');
- die();
- }
- // Succeed!
- print_r($_POST);
- }
- }
- ?>
- <html>
- <head>
- <title>CSRF - TheCodePress</title>
- </head>
- <body>
- <form action="index.php" method="POST">
- <label>Email:</label><br />
- <input type="text" name="uname" placeholder="Username" />
- <input type="hidden" name="token" value="<?php echo Security::getToken(); ?>" />
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement