Home » Php » XSS prevention in PHP

XSS prevention in PHP

Posted by: admin July 12, 2020 Leave a comment

Questions:

Possible Duplicate:
What are the best practices for avoid xss attacks in a PHP site

I need to prevent XSS attacks in PHP code, is there nay good and easy library for this?

How to&Answers:

Security is not a product. It’s a process.

If you rely on a library for security you’re doomed to being attacked one time or another.

Anyway, you could sanitize your inputs with standard php functions (i.e. htmlspecialchars())

Answer:

There are lots of PHP functions that can assist you in preventing XSS attacks. Take a look at these:

strip_tags

http://php.net/manual/en/function.strip-tags.php

htmlspecialchars

http://php.net/manual/en/function.htmlspecialchars.php

Answer:

Theres alot of good answers on google, first one I found; http://codeassembly.com/How-to-sanitize-your-php-input/

My main advice would be to consider every input as a direct attack.

So convert to html characters. Add slashes.

Answer:

http://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API

Answer:

htmlspecialchars()