PLAIN TEXT PHP: $guid = md5(uniqid(rand(), true)); md5 sanitizes the ID and limits it to 32 characters. uniqid generates a random ID based on your server's time, etc. rand() is prefixed onto the ID - thus enhancing the ID's uniqueness. true tells uniqid() to make use of "more entropy" - again enhancing the ID's uniqueness. [...]
Monthly Archives: April 2007
WordPress Plugins
This is a list of plugins I use or am in the process of evaluating IN USE Syntax Highlighting iG:Syntax Hiliter Caching WP-Cache 2 Analytics Google Analytics Feed Management FeedBurner Feedsmith SEO Optimal Title - optimise your title tags. Google Sitemap Generator. EVALUATING Tweet
Project configuration
I prefer initialising all my scripts through a bootstrap script that in turn reads a configuration file. I tend to re-use a common set of configuration parameters. PLAIN TEXT PHP: define('DEBUG_PROJECT', false); define('DISPLAY_ERRORS', true);</code> /** * E-mail send/receive related * / define('EMAIL_CONTACT_ADDRESS', 'webmaster@mysite.com'); define('EMAIL_SERVER_FROM_IDENTITY', 'MySite Webmaster'); define('EMAIL_WEB_ADMINISTRATOR', 'admin@mysite.com'); /** * Time-related */ //EOT [...]
robots.txt
A robots.txt file in your web site's root directory informs robots who follow the Robots Exclusion Protocol on which areas of your site can be indexed and which areas cannot be indexed. A simple robots.txt implementation tells all robots that your entire site is indexable: User-agent: * Disallow: But be careful not to do the [...]
Error reporting through your scripts
Your development environment might be configured to not display errors and log them instead. While this makes good sense in the production environment, while developing you want to be able to see every error and warning in order to pick up potential troublespots. You can override php.ini's error display settings via .htaccess or within your [...]
PDO – initialising a MySQL connection
PHP Data Objects (PDO) is a PHP extension that provides a consistent interface for database connectivity. This means that it allows your PHP code to talk to a number of different database formats without you having to modify your code for each particular case. This is no different (on the face of it) to other [...]
Add list items to a list via the DOM
PLAIN TEXT JavaScript: //Create new list element var new_item = document.createElement('li'); var new_item_label = document.createTextNode(title); new_item.appendChild(new_item_label); new_item.id = '467894sfs6f579f4sa6'; parent_container.appendChild(new_item); Tweet
Installing and setting up bfd
BFD (brute force detector) is an excellent package by rfxnetworks that works hand-in-hand with the APF firewall package to automatically detect and put an end to brute force access attempts. BFD works by monitoring for excessive access attempts via ssh. If it does detect attempts, it places the offender's IP in APF's deny hosts file. [...]
Securing WordPress
So I've installed WordPress and it's time to clean up the installation. Like any open source package, security vulnerabilities are well documented and open to exploitation by anyone who can read. So here are some of the steps I have taken to secure copies of WordPress. cd /home/blogger/www/blog/ rm -f wp-config-sample.php More to come... Tweet
