AntarcticPilot
Well-Known Member
Well its me as an amateur playing around and coding on the extreme of my ability so it is bound to be completely full of bad practice and all advice is gratefully received! Not 100% sure what you mean by the concatenation part , is it this
Code:$query = "INSERT INTO DATABASE VALUES( '', '$value0', '$value1', '$value2', '$value3', '$value4', UNIX_TIMESTAMP());";
rather than the concatenate statements on the Arduino?
Yes, Pete has clarified what I meant. I'm not a PHP guru, so I don't know how PHP does it, but in other languages something like:Yes. What will happen if I submit to your webserver a $value4 consisting of foo'); DROP TABLE DATABASE; ? Work out what your $query string will end up being...
Is your webserver open to the whole Internet, or is there some kind of password that only your Arduino knows? There are thousands of machines out there patiently trying out automated attacks against every server they can find...
Pete
Preparedstatement mystmnt = connection.prepareStatement( "Insert into database values (?,?,?,?,?)");
mystment.insertvalue(1,value1);
etc.
mystmnt.execute;
Is what you do. The insertvalue methods ensure that the data is escaped and sanitized such that it cannot cause a problem.
As you can probably see, Java is my most recent language!