IT BS Help

PHP Data Sanitizing

in Coding

Their are many was of sanitizinf user input on forms and other things using javascript or a php function.

Exmaple #1


//Grab Post.
$my_item_one= isset($_POST['my_item_one']) ? $_POST['my_item_one'] : "";


//Clean Data
$my_item_one = mysql_real_escape_string(htmlspecialchars($my_item_one));


Exmaple #2

//Clean Data Function
function clean_data( $input )
{
    $input = stripslashes(htmlspecialchars($input, ENT_QUOTES));
    return $input;
}

//Post from signup.
$name = clean_data($_POST['name']);

0