Skip to content

Instantly share code, notes, and snippets.

@athiththan11
Last active August 31, 2018 09:20
Show Gist options
  • Save athiththan11/5e1b1124166699f2a9b88300d696c24c to your computer and use it in GitHub Desktop.
Save athiththan11/5e1b1124166699f2a9b88300d696c24c to your computer and use it in GitHub Desktop.
CSRF Double Submit Cookies Pattern Form
<!-- csrf form -->
<form class="mt-3 mb-3" action="/src/service.php" method="POST" onSubmit="appendToken()">
<!-- csrf hidden input field -->
<input type="hidden" id="csrf_token" name="csrf_token" value="csrf" />
<div class="form-group">
<label for="php">Do you like PHP ?</label>
<input type="text" class="form-control" id="php" name="php" placeholder="not at all... ;) " required autofocus/>
</div>
<div class="form-group">
<label for="demo">Do you like this demo ?</label>
<input type="text" class="form-control" id="demo" name="demo" placeholder="waiting for your answer .... :D" required/>
</div>
<button type="submit" class="btn btn-success btn-block mt-5" name="verify">Submit</button>
</form>
<!-- End csrf form -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment