Creating webforms quickly

I from time to time want to create a quick static web form to run where PHP etc isn't involved. The best way I've found to do this is with the HTML_QuickForm PEAR package.

To install it on Debian, just install the php-pear package and run sudo pear install HTML_Common HTML_QuickForm and then you can easily create really nifty forms.

For example, the comments form below was created with the following input.


require_once 'HTML/QuickForm.php';

$form = new HTML_QuickForm('comments_form');

$form->addElement('header', null, 'Add a comment');

$form->addElement('text', 'author', 'Name', array('size' => 50, 'maxlength' => 50));
$form->addRule('author', 'Please enter a name', 'required', null, 'client');

$form->addElement('text', 'email', 'Email', array('size' => 50, 'maxlength' => 50));
$form->addRule('email', 'Please enter an email', 'required', null, 'client');

$form->addElement('text', 'url', 'Website', array('size' => 50, 'maxlength' => 50));

$form->addElement('textarea', 'body', 'Comment:', array('rows'=>10,'cols'=>50));
$form->addRule('body', 'Please enter a comment', 'required', null, 'client');

$form->addElement('submit', null, 'Submit');



It automagically does client side javascript to do first level validation and makes the form look quite nice. You can just run php file.php on the command line to scrape out the plain HTML.

google + bloglines = cool

Google Alerts is a service that fires off an email with automated searches of Google news or new websites daily.

Bloglines has a feature where you can make an email address under your profile and any email that is received will be "blogged" and appear as any other feed ... sort of like an automated email->RSS generator.

Add them up, and you've got a really cool way of keeping up to date with things you're interested in. You'll probably end up finding articles you might otherwise never have found, amazing your friends and workmates.

The only problem is that you will need to keep your email subscriptions private in Bloglines, since you have to receive the confirmation email which has details on how to cancel the web alerts (and so does each email, for that matter).

Naughty Hits

Recently I started keeping track of "people" (trojaned Windows boxes) looking for things like formail.cgi or mt-comments.cgi on my work webserver. Having now hit the 1000 unique IP address mark I thought I'd graph the locations of the offenders with geoip.

The full graph shows the USA on top by a large margin, but Spain not far behind with UK, Italy and France rounding out the top 5.

What does this mean? Nothing, really; except with a bit of coercion Openoffice can be made to make quite a nice graph (tip: to just export the graph copy it into a new "Drawing" then export that to PDF).