How safe is it for my site if I pass a table or view name as an argument in the URL? (GET method) I would like to use a single AJAX handler (both JS and PHP) and do the parsing only from the main page.
If this is not safe, and if I have two different fields using AJAX, how do I make them use the same scripts but different tables?
to handle my AJAX query, the table name is revealed to anyone using a developer's console (in Firefox 4, you can certainly see the URL for the AJAX request)
Both ideas sound good.
I also thought of a third one, whereby I pass a table-specific keyword into my AJAX handler, which then looks up the mapping and queries the corresponding table. But if I use the database, I double the queries per request - and if I use a file, I'll have to check it before proceeding everytime. And if I perform the lookup only once, storing it on a variable client-side, then it's no longer safe again...
Any thoughts?
Both ideas sound good.
I also thought of a third one, whereby I pass a table-specific keyword into my AJAX handler, which then looks up the mapping and queries the corresponding table. But if I use the database, I double the queries per request - and if I use a file, I'll have to check it before proceeding everytime. And if I perform the lookup only once, storing it on a variable client-side, then it's no longer safe again...
Any thoughts?
..how about you do the querying only once and store it in a session variable.
..Or a better solution would be to handcode the array but it wouldnt be dynamic.
__________________
Two things are infinite: the universe and human stupidity; and I'm not sure about the universe.
Albert Einstein
----------------------------------------------------- My Blogsongs
..how about you do the querying only once and store it in a session variable.
This sounds feasible, but what would be the impact on the server as traffic goes up?
Quote:
..Or a better solution would be to handcode the array but it wouldnt be dynamic.
Hand-/hard-coding the array will make the whole thing less flexible. As it is, I am looking for a script I can use on all pages, where the only changes I have to make when I add AJAX lookups is on the arguments for the 'input' tags.