|
|
 |
 |
 |
|
|
| 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
Which sounds better on your coder profiles, and makes more sense to you (think twitter, facebook, etc)? Followers / Following Fans / Following Fans / Fan Of
please login to cast your vote and see the results of this poll
|
Latest Coder Profile Changes
Coder Profile was last updated
3.49 Years Ago
|
|
|
| |
|
|
|
|