PHP projects

For the most part I do PHP scripting in Zend Studio and HTML/CSS in Dreamweaver. Depending on what I'm scripting for, I either follow PEAR/PHPDoc or Drupal/Doxygen formatting guidelines. Unfortunately, the most noticable difference is spacing. PEAR uses four spaces, whereas Drupal uses two.

I learned PHP by programming a content management system called Thatware (originally ThatPHPware) in 1998. Even though I've abandoned Thatware, it was forked several years ago by Fransico Burzi to create PHP-Nuke and all of it's forks. Naturally, as a novice programmer, Thatware is full of lots of "creative" hacks and duplicated code.

Hobby code

These are projects I worked on for free, in my spare time.

AOL Instant Messenger in TOC

I used some old documentation and some reverse engineering to create a PHP-based AOL instant messenger script for the original TOC protocol. When I showed it to Andrew Heebner (formerly of evilwalrus.com), he added some TOC2 (a revision of the original TOC protocol) functionality and lots of documentation. He called it TAC and we agreed on making it available on the internet under the Artistic License. It was created for beta versions of PHP5.

I also made some of the original TOC1-only script available, as a PHP4 class named AOL_TOC, which is copyrighted by me. It requires PEAR and it's only been tried with PEAR < 1.4.0.

Kernel.org network utilization graph copy

This is a PHP implementation of the old network utilization bar on kernel.org. It measures outgoing bandwidth on a /proc based operating system, like Linux.

Change configuration information in daemon.php. Then you might want to move daemon.php to a different directory because it must run all the time to poll the network services. Everything else should work fine if you have GD installed with PHP. Invoke daemon.php like this:

php -q daemon.php &

Be sure to run daemon.php as a user that has permission to write to the netload.inc file.

Lame-O-Nickometer

I made this one night in ##php on Freenode because Philip kept looking up peoples' IRC nicks on a Perl script for a lameness score. Many of the people had especially lame nicks like _-|Sc0rPi0n|-_. I figured why let Perl do all the work when PHP can, so I made the PHP Lame-o-Nickometer.

Also implemented as a Drupal module.

PHP CPU bar for /proc systems

This is a /proc based CPU utilization script. It is based off the phpcpubar script found on Freshmeat, but I didn't like that it had to use an external C program to get the CPU stats, so I did it in PHP. It doesn't do an instant measure. It's an average over time. There's not really much documentation.

Student housing network access control

This was meant to be a signup form using a command-line program called arping and a ISC dhcpd.leases file on an OpenBSD 3.2 server for authenticating students' computers by MAC address in campus/student housing. Priorities changed and the signup form was postponed indefinitely.

Arping is a program that works with ARP packets on a network to identify the MAC address of an IP. Right now the script essentially parses the dhcpd.leases file to get a MAC address to compare to the arping results. Both would have to match to authenticate the user and put them in the system to have their Cisco switch port activated.

Unclog

When the Code Red and Nimda worms were popular on the internet, trying to read my Apache logs was a frustrating process. I created a script to filter the worm attacks out of my Apache logs. When I submitted it to Freshmeat, they rejected it, because it's a small script.

advogato_import Drupal module

I created a Drupal module to import diary entries to a Drupal 4.6.3 website. It uses Advogato's XMLRPC interface to download a specified user's diary entries to a Drupal blog, page, or story module during regular cron jobs. Trying to import over ~20 diary entries at a time can timeout during a regular cron job, even on a fast server, with a big pipe. The unlimited import setting is only intended if you run the cron.php file from a command prompt, in shell script form, rather than as a web file through the documentation recommended wget or lynx initiated cron jobs.

Using the XMLRPC interface turned out to be much easier than figuring out how to account for every little exception when trying to extract from the /person/user/diary.xml XML file. I'm licensing it under the Artistic License, which is under some debate as to whether it is compatible with Drupal's GPL licensing. In either case, non-GPL licenses are generally not welcome in Drupal as a result of some very vocal contributors.

urllist for Drupal

This module creates a callback for generating a list of URLs to be submitted to search engines like Yahoo's Submit Your Site at /q=urllist or /urllist with clean URLs. Google has a separate gsitemap module from the Google Summer of Code 2005. Right now urllist only has a basic support to list every published node and log accesses (if the administrator turns logging on).

As soon as I submitted a urllist to Yahoo, I got a hit to load it with a User Agent of "Mozilla/4.05 [en]" from 216.155.200.103. The IP is owned by Yahoo, so I thought it would be interesting to point out the initial hit doesn't appear to come from a User Agent with "Yahoo" in the name.

Potential future features are gz output, turning off certain node types in the list, and the option to override specific nodes being listed. For now, if you use this module, and want to override a specific node, you'd have to use robots.txt to make an exclusion.

Find the urllist module home on drupal.org.

Scripting for hire

I got paid to work on these projects.

Custom CiviCRM 1.4 import script

This script was to import contact and payment data for a client. The $n and $p variables have the column names for the CSV files the data comes from. To protect the client, the contact and payment files arn't included. The sort script is intended to remove duplicate contact information, then import second, from the command line.

ISACware IMail SMTP access control

IPSwitch IMail 8.1/8.2 SMTP server has an Access Control list option in the SMTP Security tab. They don't have a tool that makes it easy to do bulk importing of IP network blocks. To make matters worse, the file where the Access Control option stores addresses is in a binary format, as smtpd32.acc, making it nearly impossible to just edit manually.

This script uses documentation from IPSwitch to generate a new smtpd32.acc file for your installation of IMail 8.1 in the proper format from the popular email blacklist sites, Okean and Blackholes.us. You could also create your own custom list of network blocks to enter into a custom smtpd32.acc file if you put it in either the Okean or Blackholes.us file format. Simply use this script to generate a new smtpd32.acc file, place it in the main IMail installation directory (C:\IMail for a default IMail installation), and restart your SMTP service.

PHP required.

Timeshare For Sale By Owner

Timeshare For Sale By Owner is a company in Orlando, FL that helps timeshare owners resell or lease timeshares and points. It's largely a cold-calling, telemarketing business. They had a Microsoft Access database they used to keep track of several thousand sales and customers. I was hired to convert their Access database to a LAMP platform. The conversion script is available, but the rest is left out to protect the client's information and processes.

This is the first time I used COM and Microsoft Jet in PHP. The script does several million loops during its execution and sucks up a lot of memory. If this script were used for more than a single one-time conversion, it could do with a bit of optimizing.

I heard a rumor, after I left, their regular tech guy denormalized the database structure I created because he didn't like table join queries, so the script is probably no longer representative of what they're using now.

myBackware

These scripts were developed to create SQL dump files for basic disaster recovery of small MySQL installations. They are capable of creating local, compressed snapshots and/or mail a copy of the SQL dump to a remote email server in a compressed, GPG (public key encryption) format.

Software development for version 1.0 was sponsored by Advanced Automation Inc.