sanitize function to prevent sql injection in php 2014


function input_sanitize_data($post){
$lowerpost = strtolower ($post);
$data = str_replace('--', '', $post);
$data = str_replace("'", '', $post);
$data = str_replace('=', '', $post);
$data = str_replace(';', '', $post);
if (!(strpos($lowerpost, ' or ')===FALSE)){ return false;}
if (!(strpos($lowerpost, 'table')===FALSE)){ return false;}return $post;
}
This function sanitize input value from form to avoid sql injection.By passing post or get value in function prevents sql injection.
SQL Injection slides

sanitize function to prevent sql injection in php 2014


//

Advertisements
About

myself pramodh kumar yet another php developer from India and have worked on oops,procedural,yii framework,codeigniter,wordpress,joomla,api and more.

Tagged with: , , , , , , , , ,
Posted in php

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow php tutorial on WordPress.com
categories
Calendar
December 2013
M T W T F S S
« Nov   Jan »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  
Follow me on Twitter
Blog Stats
  • 72,886 hits
%d bloggers like this: