Hopefully this article demonstrated a more efficient way to handle the security image problem than the original by avoiding the use of a database and hidden form fields. A feature to be added would be a "bad word" filter. Content filtering is beyond the scope of this article, though, and if you feel that you need that feature, there are many open source PHP site engines available that have content filters built in that you could borrow from.
I also used PHP4 code to reflect more up-to-date coding practices and used ImageMagick through the command line to offer another method of creating the security image. You could easily replace the ImageMagick specific code with the GD specific code from the original article and use the method I explained in this article to generate security images using GD.
When troubleshooting this code, be sure that you have set permissions on the temp directory to 777 and that you have the correct path to convert in the command that is executed. Also be sure you have the right path to the font you wish to use and be aware that if you use a different font, you will surely have to tinker with the sizes of the text to make sure it is not too large or too small for the background.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |