Reputation: 188
I'm going around with a little idea for an app in my head.
From that app there will be posted some integer values to an SQL database.
Now - from what I can read I need a script that loads an URL (php page) that will post the values.
But my question is; how can I make sure a user does not paste that url into his browser and by then posting numbers in the SQL database?
Any ideas how this can be done securely?
Bests,
rail.
Upvotes: 0
Views: 53
Reputation: 823
First: you can use POST instead of GET method in the HTML request. As a result the values you hand over to the web page will not be encrypted in the URL.
Second: you can handover some values the user can't know and is changing from time to time. For example a MD5 hash for the current date / time for example. Problem here is that it could come to problems if the data values on the clients are not up to date. So better gather a value from the client first.
Example: your app is retrieving a random number from the PHP script. Then it does some calculations on it ... let's say multiply that random number with 4 and make an MD5 hash out of the result. The server can do the same calculation and verify the parameter you hand over. If it is wrong, the request is for example because of a stored / caught URL. This is more overhead of course.
Upvotes: 1