Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
|
Of $_REQUEST['en_oil_pr'] and $_REQUEST['machid']
If someone forge the page query simply adding
PHP Code:
http://www.site.com/update.php?en_oil_pr=test&machid=1';drop table machines;
If you have not sanitized your variables, you will send a query like this:
PHP Code:
UPDATE machines SET oil_pr='test' WHERE id='1';drop table machines;
which are 2 correct sql statements for the db, and those will result in the loss of the machines table.
It's called SQL injection, and believe me, it's very common.
I see dozens of tries on my server every days...
The rule: don't use $_REQUEST/$_POST nor $_GET directly in a query.
If machid is an id, it should be numeric, so test it before:
PHP Code:
$machid=$_REQUEST['machid']; if(!is_numeric($machid)){ die('wrong record id'); }
and so on...
__________________
Only a biker knows why a dog sticks his head out the window.
Last edited by tripy; 01-18-2008 at 06:35 PM..
|