Home / Programming / Web Security / Prevent XSS Injection Attacks On PHP Easily

Prevent XSS Injection Attacks On PHP Easily


XSS Injection or also known as Cross Site Scripting is a type of code injection attack technique. Preventing XSS attacks on PHP is very important. For that I will describe the easy tricks to ward off this XSS Injection attack. Before discussing further, my previous article was about the Application of Jquery Mask for Numbers in HTML and PHP Forms, please read for those who have not applied it in the form.

Reporting from Wikipedia, XSS is carried out by attackers by entering injection scripts on a site. This attack seems to come from the site itself. So it looks like there was an error in the scripting scripting by the program maker. As a result of this attack, the danger the attacker can bypass web security from the client side, get sensitive information such as sessions, or even can insert a very dangerous script that can record all web activities.

Well, I will not explain the complete definition of XSS Injection. For more details, please visit the https://id.wikipedia.org/wiki/XSS page to get more complete information about this XSS Injection.

Prevent XSS Injection Attacks On PHP Easily

Seeing the dangers of this injection technique, I will share powerful scripts to ward off XSS Injection attacks on PHP. Here is the script:

How to apply it? it’s easy … all you have to do is use the antixss function for every php method you need, for example POST, then it becomes antixss ($ _ POST [‘variable_name’]); Consider the following example:

Recommended  5. PHP Echo and Print Statements

Very easy isn’t it !!! … I myself to get this function has sailed to China … hehe. I have applied various methods, but this function is very simple and practical. Because my heart is good, I share this free antixss script to all readers of DetriAmelia.com blog

Well, maybe that’s my first article about Prevent XSS Injection Attacks on PHP Easily. Hopefully there are benefits, if there are any questions, please write your comments below. Don’t forget to visit my blog often, because I will continue to write other more useful articles.

  • Facebook
  • Twitter
  • Linkedin
  • Pinterest


Leave a Comment

Your email address will not be published. Required fields are marked *

This div height required for enabling the sticky sidebar
Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views :