PHP Security How to Protect From A SQL Injection Attack

October 21, 2011 | By Duchateaux.

What’s a SQL Injection Attack?
Some Hacker try to Insert Malicious Code into your Database for Prepare the Execution of some Undesirable Command capable of Revealing Sensitive Information or Damaging your Database.
There are many Useful Way to follow for Prevent SQL Injection Attacks.
A Generic form of Prevention is the following:

  1. Validating Data

  2. Sanitize Data Before Insertion
    /na valid PHP twins/functions for Sanitizing are:
    • mysql_real_escape_string()

    • mysqli_real_escape_string()

  3. Typecast Numeric Values
    Example: $age = (int) $_POST[‘age’];

QuickChic Theme • Powered by WordPress