Php security | Sololearn: Learn to code for FREE!

+1

Php security

Hello guys and ladies I'm a beginner PHP developer and I have created my own CMS and I use this code to prevent vulnerabilities: Function escape($data){ $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); $data = mysqli_real_escape_string($data); return $data; } And Everytime I receive data I use this function to avoid from SQL injection, XSS and Other vulnerabilities. Please help me make it better and say your opinion.

9/1/2020 1:09:19 PM

Mohammad

2 Answers

New Answer

+2

To prevent embedding of HTML tags: https://www.w3schools.com/php/func_string_strip_tags.asp

+1

👍