Jump to content

sanitizing post variables


mikefrederick

Recommended Posts

It is necessary to validate all data that comes into your program.

 

Any post/get/file/cookie variables could have been submitted by a spammer or a spam bot script for the purpose of injecting sql, email headers, server side script, or browser script, depending on what your code does with that data (place it into a query, place it into an email, place it into a file, template, or eval() it, or output it as content to a browser.)

 

Not validating all input is just asking for someone to eventually take over your web server or mail server for their purposes or to grab your data or your visitor's data.

I would also add, validating inputs also allows you a chance to output a meaningful message to the visitor, such as a value was empty, was not a number... and then to have your code take an appropriate action, such as not putting an empty value into a query or putting a non-number into a numeric field...

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.