8 kyu

Safen User Input Part I - htmlspecialchars

4,982 of 9,462donaldsebleung

Description:

Safen User Input Part I - htmlspecialchars

You are a(n) novice/average/experienced/professional/world-famous Web Developer (choose one) who owns a(n) simple/clean/slick/beautiful/complicated/professional/business website (choose one or more) which contains form fields so visitors can send emails or leave a comment on your website with ease. However, with ease comes danger. Every now and then, a hacker visits your website and attempts to compromise it through the use of XSS (Cross Site Scripting). This is done by injecting script tags into the website through form fields which may contain malicious code (e.g. a redirection to a malicious website that steals personal information).

Mission

Your mission is to implement a function that converts the following potentially harmful characters:

  1. < --> &lt;
  2. > --> &gt;
  3. " --> &quot;
  4. & --> &amp;

Good luck :D

Fundamentals
Strings

Stats:

CreatedFeb 11, 2016
PublishedFeb 11, 2016
Warriors Trained15790
Total Skips449
Total Code Submissions31079
Total Times Completed9462
JavaScript Completions4982
TypeScript Completions503
CoffeeScript Completions25
Rust Completions662
Python Completions3399
Ruby Completions173
RISC-V Completions20
Scala Completions11
Total Stars165
% of votes with a positive feedback rating91% of 1154
Total "Very Satisfied" Votes989
Total "Somewhat Satisfied" Votes124
Total "Not Satisfied" Votes41
Ad
Contributors
  • donaldsebleung Avatar
  • Javatlacati Avatar
  • matt c Avatar
  • anter69 Avatar
  • smile67 Avatar
  • imjasonmiller Avatar
  • kazk Avatar
  • LesnyRumcajs Avatar
  • Souzooka Avatar
  • albertogcmr Avatar
  • ejini战神 Avatar
  • 4500zenja1 Avatar
  • KayleighWasTaken Avatar
Ad