secure mysql against sql injections

Discussion in 'MySQL' started by Edynas, Sep 23, 2006.

  1. #1
    I an writing some code but want to make sure I don't make the mistake to keep it open for hacks. What should I look for to make sure that it's not possible to use sql injections.
     
    Edynas, Sep 23, 2006 IP
  2. jeremyweber

    jeremyweber Peon

    Messages:
    112
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Pretty good examples here
     
    jeremyweber, Sep 23, 2006 IP
  3. Edynas

    Edynas Peon

    Messages:
    796
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks

    So if I use in php
    mysql_real_escape_string(variable)
    PHP:
    and check var type when fi it should be an integer and not allowing anything but it's covering most off the risks
     
    Edynas, Sep 23, 2006 IP
  4. jeremyweber

    jeremyweber Peon

    Messages:
    112
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    jeremyweber, Sep 24, 2006 IP
  5. intoex

    intoex Peon

    Messages:
    414
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #5
    what is about general php addslashes ?
    just escape text content with slashes, and check numerical for right format
     
    intoex, Sep 24, 2006 IP
  6. wmtips

    wmtips Well-Known Member

    Messages:
    601
    Likes Received:
    70
    Best Answers:
    1
    Trophy Points:
    150
    #6
    No, mysql_real_escape_string is more secure than addslashes. Look at the article.
     
    wmtips, Sep 25, 2006 IP