karlakmkj

Basic data sanitization

Sep 20th, 2021 (edited)
198
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <form method="post" action="">
  2. Enter some HTML:
  3. <br>
  4. <input type="text" name="html">
  5. <br>  
  6. <input type="submit" value="Submit">
  7. </form>
  8. <div>
  9.   You entered:
  10.     <?= htmlspecialchars($_POST["html"]) ?> <!--Use htmlspecialchars() function to transform HTML elements into HTML entities (characters that represent HTML elements but won’t display as HTML). This is to prevent a man-in-the-middle attack for malicious HTML -->
  11. </div>  
  12.  
RAW Paste Data