GET parameters vulnerable to SQL Injection - PHP

后端 未结 5 860
长情又很酷
长情又很酷 2020-12-21 08:05

I\'ve been asked to handle a security issue for a site which was set up by another programmer. As of yet, I haven\'t seen any of the code, so I\'m going off of assumptions a

5条回答
  •  没有蜡笔的小新
    2020-12-21 08:36

    If ID and PID are integer fields, why not casting them to int.

    That way, you are sure to have a number, an no SQL injection :

    $pid = (int) $pid;
    $id = (int) $id;
    

提交回复
热议问题