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.

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.