php - What do I need to keep a secure MySQL database? -


i've looked quite few tutorials on keeping secure database, still don't know actions need take protect database sql injections, , hackers.

this function i've been using clean out user input, feel isn't there it, other things overlooking?

function cleaninput($value) {     stripslashes($value);     if(!is_numeric($value)) {         mysql_real_escape_string($value);     }     return $value; } 

it's not bad start, here's link useful information:

http://simon.net.nz/articles/protecting-mysql-sql-injection-attacks-using-php/

the best solution? use bound parameters. use these you’ll need using improved mysqli library comes php5. technique differs in define query “template” first placeholders, , “bind” parameters it, , mysqli library takes care of appropriate escaping us:

$query = $mysqli->prepare( "update tablename set favorite_color = ?, age = ?, description = ? user = ?" ); // have bind looking this: $query->bind_param( 'sibs', 'red', 27, $some_blob, $variable ); $query->execute(); 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -