![]() | |
![]() |
| | Thread Tools | Display Modes |
#11
| |||
| |||
|
|
On 1/6/2012 8:35 AM, Captain Paralytic wrote: Paul, I know you were trying to be succinct in your posing, but your example is very bad for security. ALL strings need to use mysql_real_escape_string() to ensure characters such as quotes (') (and others, depending on the charset) are handled properly. *More importantly, it prevents SQL injection attacks. Additionally, numeric values need to be verified that they actually are numeric before inserting, again to prevent SQL injection attacks. |
#12
| |||
| |||
|
|
On Jan 6, 2:05 pm, Jerry Stuckle<jstuck... (AT) attglobal (DOT) net> wrote: On 1/6/2012 8:35 AM, Captain Paralytic wrote: Paul, I know you were trying to be succinct in your posing, but your example is very bad for security. ALL strings need to use mysql_real_escape_string() to ensure characters such as quotes (') (and others, depending on the charset) are handled properly. More importantly, it prevents SQL injection attacks. Additionally, numeric values need to be verified that they actually are numeric before inserting, again to prevent SQL injection attacks. Oh I totally agree. But the point I was trying to make was that the mess didn't have to be such a mess. I assumed that he had already pre-processed the strings with mysql_real_escape_string(). (OK, based on what we can see this is not a likely scenario, but just how much re-writing can we go doing.) Personally I almost always use the {} notation for double quoted string expansion, but I wanted to invite the OP to see the alternatives available. Happy new year BTW. |
#13
| |||
| |||
|
|
I assumed that he had already pre-processed the strings with mysql_real_escape_string(). (OK, based on what we can see this is not a likely scenario, but just how much re-writing can we go doing.) |
![]() |
| Thread Tools | |
| Display Modes | |
| |