0

how do I block the ' in the referral system? I mean what is the query of my database if I want to prevent my site from XSS Attack or SQLi (Sql injection). I have been debugging my website for about 9 hours and I found out that there is a bug in the referral area.

Now my question is, how can I block the ' sign?

Marverick
  • 117
  • 1
  • 9

1 Answers1

0

Either escape the SQL user input or use strpos to check if the user inputted string has a single quote and don't allow the SQL to be run, or use str_replace to find and replace all single quotes in the string before running the SQL.

Escaping the SQL is by far the best practice, but I've added the other options to answer your question on to block the single quote.

Community
  • 1
  • 1
Jamie Bicknell
  • 2,306
  • 17
  • 35