JavaScript is not enabled on your browser and in order to properly use Coder Profile JavaScript is required.
To view instructions on how to enable JavaScript on your browser click here .
Author Details
Code Information
Language
PHP (Hypertext Preprocessor)
Expires
Never
Length
1,287 Characters (46 Lines)
Password
no password
/**
* safe_query_inputs();
*
* This function helps you secure your query inputs
* before sending them to the database.
*
* Usage:
* $safeInputs = safe_query_inputs('input1','input2','input3');
*
* @return array
*/
public function
safe_query_inputs( ) {
foreach ( $inputs as $key => $input ) {
// Remove slashes if magic_quotes is enabled
}
// If $input is null, replace it with MySQL's keyword NULL
$output [ $key ] = 'NULL' ;
}
// Convert booleans to 1 or 0
$output [ $key ] = ( $input
) ? 1 : 0 ;
}
// If $input is numeric and contains decimals, replace the
// comma with period
}
// If $input is a normal string run it trough real_escape_string(),
// and optionaly htmlentities();
#$output[$key] = htmlentities( $input );
}
}
return $output ;
}
Please login to post comments.
Latest News About Coder Profile
Coder Profile Poll
Why do you get bored with programming?
Not enough time to do something productive I run out of ideas Too hard to show people my creations Everything i do has too many errors, and it's too hard I don't get bored!!!please login to cast your vote and see the results of this poll
Latest Coder Profile Changes
Coder Profile was last updated
1.67 Year Ago