Saturday, July 14, 2012

Stop SQL Injection in MYSQL with PHP Script

7/14/2012


Every PHP-MYSQL programmer need to know Anti-SQL Injection. Please take a look at very simple function which can save your database!!

<?php
/* 
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.in/
*/


function ClearInput($dirtyInput){
 
 if (get_magic_quotes_gpc()) {
 
 $clean = mysql_real_escape_string(stripslashes($dirtyInput));
 
 }else{
 
 $clean = mysql_real_escape_string($dirtyInput);
 
 }
 return $clean;
 
}

?>

helpful? Share this

The Editorial Team of 4everTutorials consists of a group of PHP Professionals.

0 comments:

 

© 2014 4everTutorials. All rights resevered.

Back To Top