# Always escape all data that come from a user that are headed into your database (use mysql_real_escape_string() or bind the values to prepared statements using MySQLi or PDO). This is to prevent data supplied by the user, being confused with your SQL code. http://php.net/mysql_real_escape_string http://php.net/pdo
 
# Always escape all data that come from a user that are headed into your database (use mysql_real_escape_string() or bind the values to prepared statements using MySQLi or PDO). This is to prevent data supplied by the user, being confused with your SQL code. http://php.net/mysql_real_escape_string http://php.net/pdo
 
# Be sure to use escaping *correctly*! If you use mysql_real_escape_string() on a value from $_GET, then because you think its a number, you don't put quotes around the variable in your SQL - You're vulnerable to injection! Since an attacker doesn't need to "break out" of your quotes (because he's not inside any), he can inject raw SQL commands and mysql_real_escape_string() can do nothing to stop him. Now, Database engines don't particularly like it when you quote integers, as it causes them to run a bunch of internal code for each row to convert them, which is why people commonly try to leave the quotes off. You have three choices to solve this problem.
 
# Be sure to use escaping *correctly*! If you use mysql_real_escape_string() on a value from $_GET, then because you think its a number, you don't put quotes around the variable in your SQL - You're vulnerable to injection! Since an attacker doesn't need to "break out" of your quotes (because he's not inside any), he can inject raw SQL commands and mysql_real_escape_string() can do nothing to stop him. Now, Database engines don't particularly like it when you quote integers, as it causes them to run a bunch of internal code for each row to convert them, which is why people commonly try to leave the quotes off. You have three choices to solve this problem.
Exception encountered, of type "Error"
[70db53e5] /index.php?title=16_Tips_for_Secure_Code&diff=cur&oldid=637 Error from line 434 of /misc/21/000/105/835/1/user/web/wiki.hashphp.org/includes/diff/DairikiDiff.php: Call to undefined function each()
Backtrace:
#0 /misc/21/000/105/835/1/user/web/wiki.hashphp.org/includes/diff/DairikiDiff.php(544): DiffEngine->diag(integer, integer, integer, integer, integer)
#1 /misc/21/000/105/835/1/user/web/wiki.hashphp.org/includes/diff/DairikiDiff.php(344): DiffEngine->compareSeq(integer, integer, integer, integer)
#2 /misc/21/000/105/835/1/user/web/wiki.hashphp.org/includes/diff/DairikiDiff.php(227): DiffEngine->diffLocal(array, array)
#3 /misc/21/000/105/835/1/user/web/wiki.hashphp.org/includes/diff/DairikiDiff.php(721): DiffEngine->diff(array, array)
#4 /misc/21/000/105/835/1/user/web/wiki.hashphp.org/includes/diff/DairikiDiff.php(859): Diff->__construct(array, array)
#5 /misc/21/000/105/835/1/user/web/wiki.hashphp.org/includes/diff/DairikiDiff.php(980): MappedDiff->__construct(array, array, array, array)
#6 /misc/21/000/105/835/1/user/web/wiki.hashphp.org/includes/diff/TableDiffFormatter.php(194): WordLevelDiff->__construct(array, array)
#7 /misc/21/000/105/835/1/user/web/wiki.hashphp.org/includes/diff/DiffFormatter.php(140): TableDiffFormatter->changed(array, array)
#8 /misc/21/000/105/835/1/user/web/wiki.hashphp.org/includes/diff/DiffFormatter.php(82): DiffFormatter->block(integer, integer, integer, integer, array)
#9 /misc/21/000/105/835/1/user/web/wiki.hashphp.org/includes/diff/DifferenceEngine.php(888): DiffFormatter->format(Diff)
#10 /misc/21/000/105/835/1/user/web/wiki.hashphp.org/includes/diff/DifferenceEngine.php(802): DifferenceEngine->generateTextDiffBody(string, string)
#11 /misc/21/000/105/835/1/user/web/wiki.hashphp.org/includes/diff/DifferenceEngine.php(733): DifferenceEngine->generateContentDiffBody(WikitextContent, WikitextContent)
#12 /misc/21/000/105/835/1/user/web/wiki.hashphp.org/includes/diff/DifferenceEngine.php(662): DifferenceEngine->getDiffBody()
#13 /misc/21/000/105/835/1/user/web/wiki.hashphp.org/includes/diff/DifferenceEngine.php(632): DifferenceEngine->getDiff(string, string, string)
#14 /misc/21/000/105/835/1/user/web/wiki.hashphp.org/includes/diff/DifferenceEngine.php(453): DifferenceEngine->showDiff(string, string, string)
#15 /misc/21/000/105/835/1/user/web/wiki.hashphp.org/includes/page/Article.php(795): DifferenceEngine->showDiffPage(boolean)
#16 /misc/21/000/105/835/1/user/web/wiki.hashphp.org/includes/page/Article.php(506): Article->showDiffPage()
#17 /misc/21/000/105/835/1/user/web/wiki.hashphp.org/includes/actions/ViewAction.php(44): Article->view()
#18 /misc/21/000/105/835/1/user/web/wiki.hashphp.org/includes/MediaWiki.php(395): ViewAction->show()
#19 /misc/21/000/105/835/1/user/web/wiki.hashphp.org/includes/MediaWiki.php(273): MediaWiki->performAction(Article, Title)
#20 /misc/21/000/105/835/1/user/web/wiki.hashphp.org/includes/MediaWiki.php(566): MediaWiki->performRequest()
#21 /misc/21/000/105/835/1/user/web/wiki.hashphp.org/includes/MediaWiki.php(414): MediaWiki->main()
#22 /misc/21/000/105/835/1/user/web/wiki.hashphp.org/index.php(41): MediaWiki->run()
#23 {main}