Archive for December 22nd, 2004

That New VHost Smell

Wednesday, December 22nd, 2004

BrettEpps.com now is a working domain with full hosting set up for it. I have an eight-domain package with MediaCatch that really rocks my socks (unlimited hosting for eight domains for only $95/year), so I just added on another domain. By the way, I really recommend MC for all your hosting needs. Though I’ve been waiting a long time for them to finally get around to upgrading to PHP 5, everything else has been great. Like every host, they have outages periodically, but not nearly as often as past hosts.

It’s really nice to have a clean “server” to work with…brettia’s web space has been getting cluttered with defunct projects and little experiments that never came to fruition. I think I might request that they wipe my account if I end up upgrading to MC’s basic reseller hosting package (which would allow me to host hundreds of websites on the same account for about $17/month).

PHP to the Rescue

Wednesday, December 22nd, 2004

In the course of moving, many documents must be emailed/faxed/telekinetically transferred back-and-forth between various parties. One of these documents came as an email attachment that wouldn’t open. We requested that the sender resend it, but I decided to go ahead and see if I could rescue the attachment (it was supposed to be a PDF) anyway. For some reason, the attachment had a .msg extension, so I tried to open it in Outlook. Didn’t work. I was more successful using Thunderbird, the Mozilla Foundation’s email client that was made as a companion to Firefox. Thunderbird couldn’t get it right either, though, but it at least opened it in a plain text format so that I could see the source code of the .msg file (equivalent to opening it in Notepad).

Because the email message code shows all of the headers that are prepended to every email message, I could tell that the attachment part of the message was encoded using the base64 algorithm, which isn’t really secure, though it is good enough to keep the encoded file or message from being readable by the average human (unless you’re really smart). Base64 is also the encoding used for HTTP passwords on websites such as private company networks and hidden control panels such as the cPanel administration area that most web hosts use.

Since the base64 algorithm is so widely used on the Internet, I decided to check and see if PHP had a function that could decode a base64-encoded string (a chunk of text). Lo and behold, it did. In seven lines of PHP, I was able to make a script that read the messed up message, pulled out the base64-encoded PHP attachment, decoded it, and rewrote the resulting code to a new PDF file. Mission accomplished.

As it turned out, our new address was wrong on the document, so the sender had to send a new one anyway. But this was the first time I ever applied PHP to a real-life problem like that, so it was kind of cool.

Rounded

Wednesday, December 22nd, 2004

Behold, the very-much-alpha-quality release of “Rounded”, the new design for BrettEpps.com, which currently redirects to Brettia. It’s round and smooth, like me!

Click here to view it.