karlakmkj

Basic data sanitization

Sep 20th, 2021 (edited)
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.43 KB | None | 0 0
  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.  
Add Comment
Please, Sign In to add comment