Hi All,
I'm building a new site -- where people can save code to my database, but after my sites got hacked last week -- i'm really starting to see how important it is to protect against sql injections. :xbones:
So,
Right now i'm using this...
$value = $_get['val']; // e.g. A MYSQL QUERY BEING SAVED TO THE DB LIKE SELECT * FROM TABLE
if ( get_magic_quotes_gpc() ){
$value = stripslashes( $value );
}
$value = "'" . mysql_real_escape_string( $value ) . "'";
// Its passed -- insert into DB...
But i've just read that mysql_real_escape_string doesnt help with the ` character. (This vBulletin forum let me save it to their DB - so i'm gussing there is ways of securing against it)
As i am saving code to my DB, i also need everything to stay "intact" or how it is entered.
Any help in this would be amazing!!!
Also, on a quick note, i've been using this (which i now know is stupid!)
$getthis = $_GET['val'];
include($getthis . '.php');
I never even thought about hackers entering somthing with "?=" at the end to hack my sites I'm such a newbie!!!
Cheers again for the help