Validate email domain using PHP’s checkdnsrr with CodeIgniter
I recently noticed a bunch of garbage registrations for an existing client’s newsletter function written quite some time ago. After making a copy of the subscribers table and “cleaning” the data (proper-cased names, lowercased emails, etc), I started looking at ways to limit these automated registrations.
The client would not be happy with registration confirmation emails, so I decided to make a callback function for use with CodeIgniter’s Form Validation library. Since it was only needed in one location, this method made more sense to me than extending the main library.
Here is the function…
GoDaddy, Filezilla and getting blocked while uploading via FTP
I write code for a growing number of clients who host their sites with GoDaddy and Wild West Domains (GoDaddy’s Resller Program). My aresnal includes Photoshop & Expression Web (not a huge fan of Dreamweaver) for visual layout, Filezilla for uploading, and Notepad++ for coding (tried nppFTP plugin for FTP, that didn’t last long, too “buggy”).
Frequently I would be uploading a files after making my initial FTP connection and within a few minutes the connection would time out and I would be unable to reconnect. I figured since it was a shared hosting environment, their hardware and/or software firewall was just being very cautious. After cloning my PC’s IP address in my local router and restarting my cable modem (force renew my IP), I was able to resume work. Inevitably the issue would creep back up quickly.
CodeIgniter, MySQL and User-Defined Variables
The lesson for today is… how to sort records sequentially on a numeric column and provide the ability to move records up and down in the existing sort order.
There are 2 functions I use for manual record sorting to change the display order in admin/user areas. The following example is based on a “pages” table and the commands are located in a model. For this example, the table has the following fields: page_id (int), page_sort (smallint), page_title (varchar), and page_content(text).
XHTML compliant external links based on anchor href attribute
The inspiration for this code was New-Window Links in a Standards-Compliant World. They were using the “rel” attribute and checking it for “external” to update the anchor’s target attribute. I lean towards not opening new windows unless it’s an off-site link to improve the user’s experience. Furthermore, I try to avoid adding more code when I can simply use an element’s existing attributes to serve my needs.
Table/record sorting made easier for CodeIgniter
In a project I am currently working on, I needed a way to efficiently allow sorting of the records in an admin area while preserving the functionality of a search function (that passes the query in the url) and the pagination library. Initially it started off as a section of each method where sorting was allowed (record lists of things like countries, states, etc). My sorting routines finally ended up being put into their own helper.
