google is your friend
Printable View
google is your friend
I wouldn't rely on third-party browser plugins to validate all scripts for potential sanitization flaws. Rather, I would just ensure proper tags and other HTML entities are escaped, as are possible SQL character controls (Space, single/double quotes, and backslashes).
Anyways, as I stated, as long as a-z, A-Z, and 0-9 characters are the only accepted form of data, virtually nothing can cause a problem. Now, granted, formatting characters may be needed, which is why you escape everything (As stated, HTML entities, and escape SQL char. controls).
Way to be completely void of help.
Your release stripped that and much more:
http://forum.ragezone.com/f245/my-wa.../?#post4993113
Let's see - words such as "select" and "varchar" are automatically removed, without notifying anyone - as I mentioned, if my password were say, "select1", then my password would be "1" without the end user being notified.Code:function antisql($sql) {
$sql = preg_replace(sql_regcase("(select|union|0x|cast|exec|varchar|insert into|delete from|update account|update login|update character|ugradeid|drop table|show tables)"),"",$sql);
$sql = trim($sql);
$sql = strip_tags($sql);
$sql = addslashes($sql);
return $sql;
}
Rather than remove excess spaces and tags, it's easier to not permit those symbols.
Also, your add slashes will cause an annoyance if magic_quotes_gpc is on, as detailed in http://us3.php.net/addslashes. (e.g.: \' would turn to \\\', inserting a backslash before the quote).
So no, that s most certainly not what you were doing.
I don't see why anyone would put "select" as their password anyways :P it would be rare if anyone did though.
Uhh..why are slashes being stripped? And, why wouldn't you just do:
PHP Code:function sqlesc ( $x ) {
return mysql_real_escape_string ( stripslashes ( $x ) ); // stripslashes() still isn't needed..
}
That still doesn't represent the function you released, which you still claimed, "just felt safe".
Also, where's your MSSQL equivalent? Is your MSSQL equivalent the one you released?
It's all theoretical.
I don't know why I didn't use it, variables don't really matter. It was a matter of keeping it clarifying probably.
Also, that "just felt safe" was just a joke, lol. Don't be so serious. I've got lots of experience in MySQL injections, I'm looking into MSSQL ones ATM. Thought they were the same.
Having experience in modifying queries via unchecked forms isn't something you can have experience in - unless you've attempted to manipulate many forms, then that's not something you would brag about.
Anyways, injection tactics are the same across SQL databases, for the most part.
Take a look to this
http://www.psoug.org/snippet/AntiSQL...unction_18.htm
I use this one.
~IcemanPHP Code:function antisql($sql)
{
$sql = htmlspecialchars($sql);
$sql = str_replace("'", '& #039;', $sql);
$sql = str_replace('"', '"e;', $sql);
return $sql;
}
Don't forget to include the sanitize_data function in whatever script is calling it!