Jump to content

Is it safe to check php page with javascript?


garyed

Recommended Posts

I wasn't sure where to post this so I apologize if this is the wrong forum. I have a php page with over 50 numerical inputs on a form. A lot of the inputs are used to get data out of the mysql database so I want to be safe from sql injection. Is it safe to use a javascript onsubmit function that will not allow the form to be submitted if there is any non numeric data entered by the user? I've already written the function & it works fine but I'm not sure how much protection it gives me. Any feedback welcome.   

Javascript only prevents a refresh from happening, it will not proect against invalid data being sent to the server.

there are many tools out there which disable and alter javascript. So it's not a good replacement system to a php script. It works well in conjunction.

Javascript only prevents a refresh from happening, it will not proect against invalid data being sent to the server.

there are many tools out there which disable and alter javascript. So it's not a good replacement system to a php script. It works well in conjunction.

you most certainly can filter data with javascript, however it is not advisable because the user can disable javascript, thus disabling your js filtering.

If you are going to go the javascript route, make sure that you have some back end code that will check the user input as well.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.