Stop the Spam, Create your own CAPTCHA

From the official site, CAPTCHA stands for Completely Automated Public Turing Test to Tell Computers and Humans Apart. If you drop the “to” and “and”, shouldn’t it read CAPTTTCHA instead?

CAPTCHAs are those images you see with a phrase in them. The user has to type in the phrase they see in the image and the script upon submission will compare the user phrase with the saved phrase. If the two match then the submission goes through; if not, the user is booted back to the form usually with an error message.

The reason for the use of CAPTCHA images is to tell computers and humans apart as the meaning says. Computers have a hard time determining the phrase because of the other lines criss-crossing over the letters, so scripts can’t be run on the comment form.
Continue reading


Using POST and XML in AJAX

In an earlier entry, Missing Data After AJAX Call, I threw a hack together to return multiple values which required parsing based on a separator on the client side.

After testing, I realized using a character as a separator is a bad idea. The data returned could have the character as part of its value and screw up the parsing later on the client side. Storing the data as XML and returning the data as such makes for a more elegant solution.

I also wanted to send a large amount of text through AJAX and the GET request was not getting the job done. Using POST instead of GET works well; the reason behind it is similar to why it works for forms or forum postings.

Talking about the what’s and why’s does not make it very clear. That is why I brought an example with me including the corresponding code. w00t!
Continue reading


Pagination with PHP

The other day, I was looking for a decent tutorial on creating pagination using PHP. I did a couple Google searches, but the results did not fit my criteria. I was looking for a caterpillar pagination where there is a head, a tail, and a middle section that moves along as you click through the pages.

Previously, the site I was working on had used a previous/next deal where the user would just keep clicking next to get further through the records. But, this type of navigation takes too long to get to the end and is not very search engine friendly.
Continue reading


Missing Data After AJAX Call

I was working through the night last night, burning the midnight oil as they say, trying to get this AJAX deal to work. I had to fill a select field with options once the user selects an option from a second select field. But, every time I made the AJAX call to retrieve the data, the target select field remained empty… in IE. Argh! IE! Why do you haunt me so?!
Continue reading