Which PHP functions? For security SQL/PHP?

Discussion in 'Programming' started by Kevin Design, Aug 6, 2008.

  1. #1
    Hi, i was just wondering which PHP functions are essential to protect against SQL injection and any other hacker attack?

    I am currently creating a blog which has an admin area, and i want to be sure that i have done everything possible to protect myself from attack, the functions are mainly to protect my $_POST's before entering them into my SQL database.

    Im not sure which is the most effective out of the following as im pretty new to all this:

    - mysql_real_escape_string()
    - htmlspecialchars()

    Im sure there are others?

    Thanks in advance ;)
     
    Kevin Design, Aug 6, 2008 IP
  2. CodyRo

    CodyRo Peon

    Messages:
    365
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You're going to be using those namely.. the first to escape when grabbing SQL results and the latter when outputting content submitted by users (possible tainted).

    There's a couple others such as htmlentities(), but what you have should suffice :).
     
    CodyRo, Aug 6, 2008 IP
  3. Kevin Design

    Kevin Design Guest

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for that Cody ;)
     
    Kevin Design, Aug 6, 2008 IP