I am working on an existant web page and I modify the DOM with jQuery.
In my script, a POST Ajax call sends to a php file the parameter registration_id
, which is only composed of numbers (for example 310).
This parameter is passed in a SQL request which returns 3 elements (id
, context_id
, time_spent
from trackings
table)
So, I have implemented some security in my php code:
- I check if the POST Parameter is set
- I check if the length is < 5
- I check if the parameter is only composed of numbers with ctype_digit()
- 4th security: the access to the database is strict: I created a user which can only SELECT on
trackings
table the fieldsid
,context_id
,time_spent
.
What do you think about that ? Do you think I have to make prepared requets ?
Thank you in advance for your advices
Thomas