Delphi for PHP Article 3: A Brief History of Time and Delphi for PHP

When I was first fiddling around with the beta test stuff for Delphi for PHP, and before I’d gotten BetaBlogger status, I’d put together a post with what history I’d been able to scrounge about D4PHP from the WayBack Machine and Google.   I’d never gotten around to posting what I’d found.  Before it disappears forever into the nether regions of my harddrive, I thought I would hit Paste and Publish. 

I think I’ve gotten most of the details correct, but there are some guesses that might be inaccurate. Also, there are loads of links because I wanted to make it VERY clear that this info was gathered from the web and I was not breaking my NDA.  That’s not a concern anymore, luckily. You might find some of the links interesting. 

 So, here’s the history of Delphi for PHP as I know it:

Continue reading Delphi for PHP Article 3: A Brief History of Time and Delphi for PHP

Delphi for PHP Article 2: A Lazy Sunday (Video)

OK, I just got back from church and I am stuffed from the three bowls of soup and a huge salad.  So, I am feeling lazy, but I still want to get a Delphi for PHP article out (since I have a limited exclusion from my NDA and am alowed to discuss such matters or so I must say in each of these articles.)

 So, today you get treated with a video I made for the other Delphi for PHP testers.  It isn’t too exciting, but it will show you a little bit about the underlying structure of the DB Demos in the beta releases of Delphi for PHP.  I should say that it is entirely possible that the demos requiring the steps described in this video will be reworked for the final product.  If that’s the case you likely won’t have to do much, or ANY of this process in the full blown 1.0 process.

If you are new to PHP programming, you can use this process to create a webserver on your local home computer.   That’s downright handy for testing any web product.  So, you’ll benifit that way even if the Delphi for PHP stuff isn’t too handy for ya.

 OK here you go: 

The Delphi for PHP Beta Bloggers are on their way!

I was granted my Delphi for PHP BetaBlogger priveledges back on March 1.  I was the first to have that priveledge, but it was done specificaly so that I could have discussions with the WordPress folks at Automattic regarding a possible joint CodeGear/WordPress project for the 2007 Google Summer of Code™.  Unfortunately, with everyone crunching for possible product releases while the CodeRage conference was happening, the logistics could not be nailed down.  (BTW, that’s no problem.  What it REALLY means is that it openned the door for several other opportunities.  The first of which I’ll announce tomorrow.  Of course Matt‘s and Lloyd‘s readers already know all about it…) 

Though I had the legal rights to discuss the Delphi for PHP project with you, the BetaBlogger program had not officially started and I didn’t want to approve my priviledges.  So, while I did release one video and did another for the testers, I’ve kept mostly quiet until the full Beta Blogger program began.  Well that day is almost here.  

The WordPress for PHP BetaBlogger is about to start in earnest and I plan to be on top of this thing.  And I need your help to pull that off.  (Oh yeah, I should say in so-many-words that I am allowed to discuss this with you because I have a limited exclusion from my Delphi for PHP Non-Disclosure.  You will now be returned to your regularly scheduled program, already in progress)

Here’s my proposal: I will inform you of EVERY new D4PHP BetaBlogger post I hear spoken about behind the closed doors, and you all, come back here to this post and leave a comment for every one YOU see.  In return I’ll continue to put out Delphi for PHP videos and samples (as I have time) until you know this great new PHP tool inside and out.

Does that sound like a plan or what?  Is it a deal?

Delphi for PHP Article 1: A Video Walk Through

Rumors have been flying around for the last month about Borland producing a PHP product. “PHP? Are they nuts?” some said, “Concentrate on what you know! Are you trying to create another Kylix just to have it fade away to nothing?” Needless to say, I was a bit more optimistic than that… I mean come on! RAD PHP development? How cool would that be? PHP has the EXACT same feel as Pacal did back in the late 80s. It’s a baby language just starting to grow up. Even the people in it have the same core “I’m gonna help you because I know later you will help me” attitude that Pascal and Delphi always had.

Plus, since the restructuring of Borland has sifted the chaff from the wheat, CodeGear seems have its act together and the people of CodeGear are really the cream of the crop. (Yes, I know. I just said that they are Cream of Wheat, let it go… just let it go.)

Well, dreams came true when I was invited to be a CodeGear field tester. And last Thursday morning, with the verbiage hot off the presses from the Borland legal department, I was granted a limited exemption from my NDA (Non-disclosure agreement) to pitch a possible Google Summer of Code 2007 joint D4p/WordPress project to Automattic (I’ll let you know later how that turns out…). That NDA exemption also gave me permission to post articles and write reviews of the product. So here we are today!

So, now I can show you tell you all about the cool stuff I’ve been doing and show you movies I’ve made of the product in action.

In my usual fashion, I’ve written a gargantuan article. Instead of posting huge thing, I’m splitting the sections off into separate articles. Today, I just want to give you walk through of the product and show you some of the stuff that makes it unique.

This video uses a pre-release version of Delphi for PHP. Components, look and feel, and features may change before release. THIS VIDEO HAS SOUND.

If you have any problems with the video playback on any browser please let me know and I will try to get it to work.

Build your own spam filter with PHP and DNSBLs

Have you ever gotten an email asking if want certain parts of your body enlarged, parts that you might not even have? Was the next email you read one asking if you want to loose the inches you’ve recently gained? Did you ever notice how these emails are always from people that you are fairly certain have nothing to do with the contents of the email. Did really send that diet pill email? Have you ever gotten returned or rejected “can’t be delivered” emails from addressed you’ve never ever sent an email to?

I have.

SPAM. It’s HORRIBLE! My email box for probably gets 3 to 1 spam over real email. I expected that. I put that address out everywhere and don’t protect it. It is meant to be my public address. But the FROM addresses on all that email never indicates who the email is really from. Even the company information inside the email header is faked. The spammers will grab someother name on their spam list and use it as their from address. I’ve had my name put into the from address of emails a few times. It’s an annoying problem, just ask the Nuclear Moose.

Why this can happen is a long story. It all relates back to the fact that SMTP and port 25 were never meant for submitting emails to email servers. SMTP was only meant for server to server communications. However, that’s for a different post. The long and short of it is that everything can be faked except for one thing: the IP address of the server that sent the email.

Because that IP address is accurate, you can use it to tell if the person that sent the email is a spammer. The post tells you a couple ways to do that. And because this is The Code Cave, you get a fully functional php routine to boot.
Continue reading Build your own spam filter with PHP and DNSBLs

How not to query a Quake, Halflife, RtCW, FarCry game server status via PHP…

This is the story of a man who simply want to create a nice page describing the users of a few games servers for a Return to Castle Wolfenstein mod called The WildWest.

He was over joyed when he stumbled across a PEAR module called GameServerQuery. He’d spent hours and hours trying to get QStat to work on his server, but it never did work and no one could tell him why. He spent additional hours trying to find a PHP module that did the same thing, but everything he found was a wrapper for QStat. He’d given up on the search a full year before he stumbled across PEAR’s GameServerQuery. So, you can just imagine his joy.

Well, that joy was short lived…as the pain soon began. If you don’t want to know the whole sad story, feel free to jump ahead to the summary section where you can see the final results and decide what will best work for you.

The Painful Process

Now, if you are on a shared server, chances are you cannot install cusotm modules until you gotten your own instance of PEAR up and running. Read about how to do that here. After you have done this you are ready to install the GameServerQuery module.

Here’s how an average user would install the GameServerQuery module:
pear install –alldeps Net_GameServerQuery

Except that for 1and1, it won’t work. That command asks PEAR to install the latest officially released version. Right now that’s version 0.2.0. An Alpha release. And by default, only allows stable versions to be installed in a generic request.

So you have to request a specific version. Here’s how you do that:
pear install –alldeps “channel://”

BUUUUUT for, that won’t work. It gives you an error that Net_GameServerQuery requires PHP version 5 but the default version installed on is version 4.4.2. But as loyal readers of know, all users can run php 5 with a 1 line change to .htaccess. However, even with that change, PEAR has no way of determining that, at runtime, php5 will be used instead of php4. So, you have to tell the module to install no matter what… To do this you override that option by adding the –force option. Just like this:
pear install –alldeps –force “channel://”

AND THAT installs GameServerQuery!


Except…. that this version doesn’t work. It is all full of alpha version issues. For example, it was obviously written on a Windows Machine for all of the slashes are back slashes instead of forward slashes. That simply won’t work on a Linux server. It’s a novice PHP programmer mistake. Another problem is that as the code is written on, you would have to put a php.ini file in every PEAR GameServerQuery subdirectory. And that’s just not the way to do things!

Fortunately the newest version of GameServerQuery is available through CVS to install:

However, my CVS program is royally messed up right now and I haven’t needed it for ages. So I wasn’t about to mess with it again. So I decided to build an htm file from the contents of the XML file
( that describes the source files in the repository.

I REALLY think that should have been the hard way to do it. But I could not figure out the url for the zip or tarball for that release. If you know of an easier way to download a zip of a specific version of a viewvc processed cvs archive, I’d REALLY like to hear from you!

But anyway, I did the old right-click-save-as dance for all of the files and put them in the appropriate directories. I’ll save you that work. Here’s a zip:

You can extract it to the PEAR/PHP directory or to your web directory…

I have zipped up the examples too:

They’ve been somewhat mutilated by me in my testing. You can get the real ones here:
if those don’t work.

Version 1.0.4 is a working version (with one minor change) of GameServerQuery and produces very nice report of the server properties and reports.

BUUUUUT it won’t run This one is not their fault. It won’t ANY shared server to the best of my knowledge. I have seen at least one reference saying that access to socket level communication is restricted to root level access on (all?) shared server environments. It makes some sense that it would be. There is only 1 machine and that one machine might have to try and leverage a common socket across many different virtual servers. 1and1 just won’t/can’t let a single server lock up a socket.

What will happen when you try to connect out on a port, is that you will set off all sorts of internal alarms and you’ll get an email from the Customer Compliance Operatives (I’m serious – that’s how they sign their emails: “Customer Compliance Operative – 1&1 Internet Inc.”), but that’s a tale for another time.

So, what do you do? Well, it is simple. You use XAmPP to create a server on your local windows machine. Don’t bother with the whole PEAR install thing, just extract the zip (with directories in tact) to the folder that contains your example files and all will work beautifully. Then you just need to modify the scripts to produce static files and upload the results to your account on a regular basis – say every 15 minutes or so. Easy Peasy!


While manually downloading the 1.0.4 version of GameServerQuery produces a functional report on dedicated webservers, for it will not work on vitual hosts, you get a basic array in return and must do all the needed formatting yourself. The example files show some simple ways to do that. As shown here:
Game Server Query Pear Module output

Now that I knew the terms to search for, I was able to find another package on SourceForge that does this exact same thing in a much more professionally refined fashion. The package is called PHGStats. It includes an installation script that guides you through creating a configuration file for the servers you will monitor. It produces will formatted pages with special functions for each game, such as color code support in server and player names.
With very little configuration, you get nice server lists that look like this:

PHGStats server list.

and player lists that look like this:
PHGStats player list.

I think both tools have their place. I will probably use the QueryGameServer to create a program that monitors the servers and emails people when there is somene waiting around for a game. I’ll probably have it check the servers every 3 minutes or something like that. The second heavy weight tool will be used to generate pages every 15 minutes or so…