Anti-SQL Injection
9
Connect to MySQL db & display result from Table query
8
Fixed missing $ sign.
11
This only seems appropriate, we were fighting with a similar issue this morning.
-7
I use this method for keeping my sql templates away from my code.
You can extend upon the idea, as I have done in the past, by placing SQL handing classes between your scripts and the template library.
Things to note here:
The lesser userd heredoc string method. The reason this is used is to keep the SQL clear and well laid out, and not as messy as using quotes.
vsprintf() is a very handy function if you don't want to hard code the number of parameters to interpolate your string with.
The use of sprintf templates offers you additional security. For example, only allowing numbers to be placed where a %d falls. This, of course, shouldn't be the only security on user supplied variables, but comes in extra handy for debugging purposes.
Regarding the TODO in there, it would take a check of the number of % placeholders there are in the template. One caveat is remembering to remove the count of %%'s that appear (the literal percentage).
You can extend upon the idea, as I have done in the past, by placing SQL handing classes between your scripts and the template library.
Things to note here:
The lesser userd heredoc string method. The reason this is used is to keep the SQL clear and well laid out, and not as messy as using quotes.
vsprintf() is a very handy function if you don't want to hard code the number of parameters to interpolate your string with.
The use of sprintf templates offers you additional security. For example, only allowing numbers to be placed where a %d falls. This, of course, shouldn't be the only security on user supplied variables, but comes in extra handy for debugging purposes.
Regarding the TODO in there, it would take a check of the number of % placeholders there are in the template. One caveat is remembering to remove the count of %%'s that appear (the literal percentage).
7
Using the extract() Functio
21
Proper Paragraphs
28
Create a Thumbnail
5
Return a Portion of a Character String
5
Random String
23
Get the Size of a Folde









