|
| 1 | +<!DOCTYPE html> |
| 2 | +<html> |
| 3 | + <head> |
| 4 | + <meta charset="utf-8" /> |
| 5 | + <meta name="viewport" content="width=device-width, initial-scale=1" /> |
| 6 | + <title></title> |
| 7 | + <script src="https://unpkg.com/axios/dist/axios.min.js"></script> |
| 8 | + <script> |
| 9 | + function registerHorse() { |
| 10 | + let data = new FormData(); |
| 11 | + var imagefile = document.querySelector('#horseimage'); |
| 12 | + data.append('horsename', document.getElementById('horsename').value) |
| 13 | + data.append('horseimage', imagefile.files[0]) |
| 14 | + axios.post( |
| 15 | + "/submit", |
| 16 | + data, |
| 17 | + { headers: { |
| 18 | + "Content-Type": "multipart/form-data", |
| 19 | + "Access-Control-Allow-Origin": "*" |
| 20 | + |
| 21 | + }} |
| 22 | + ).then((response) => { |
| 23 | + if(response.data['success']==true || |
| 24 | + ( |
| 25 | + response.data['success']==false && |
| 26 | + response.data['error']==="You have already submitted a solution!" |
| 27 | + )){ |
| 28 | + alert('Horse submitted. See you at the Kentacky Derpy...') |
| 29 | + console.log(response.data); |
| 30 | + //window.location.replace("https://puzzles.hack.gt"); |
| 31 | + }else {console.log(response.data);} |
| 32 | + }) |
| 33 | + .catch((error => {console.log(error);})) |
| 34 | + }; |
| 35 | + </script> |
| 36 | + </head> |
| 37 | + |
| 38 | + <body> |
| 39 | + <section id="main"> |
| 40 | + <h2 style="text-align: center;">Find yo shit:</h2> |
| 41 | + <center> |
| 42 | + <label for="query">Query: </label> |
| 43 | + <input type="text" id="query" name="query" placeholder="query"> |
| 44 | + <label for="query">Secret: </label> |
| 45 | + <input type="text" id="secret" name="secret" placeholder="secret"> |
| 46 | + <button id="submitbutt"> I'm feeling sussy</button> |
| 47 | + </center> |
| 48 | + </section> |
| 49 | + <script> |
| 50 | + document.addEventListener('DOMContentLoaded', (event) => { |
| 51 | + console.log() |
| 52 | + document.getElementById("submitbutt").addEventListener("click", registerHorse); |
| 53 | + }); |
| 54 | + </script> |
| 55 | + |
| 56 | + <!--<section id="sponsors"></section>--> |
| 57 | + |
| 58 | + |
| 59 | + </body> |
| 60 | +</html> |
0 commit comments