Fruits of my Labour

PHP has been an annoyance to work with, although I somehow managed to write something vaguely (useful?) with it – a ‘predictions league’ thing commissioned by a friend (whose site I somehow got roped into hosting). I actually managed to write this in a few hours as a first PHP/MySQL project which in my opinion is pretty fast considering I had to learn my way round PHPMyAdmin for a good half hour setting up the DB then start learning PHP starting from the MySQL end, learning the hard way that die(…) literally means the script, well, dies.

The requirements for the program was that people would log in / register and be able to predict scores on upcoming matches. Their predictions end up in a database, and when a match finishes, admin enters the results into another table in the database, at which point a script runs to compare each person’s predictions against the real result. A formula works out the number of points they get based on similarity to the actual score, and their points accumulate over the whole season.

Apart from some teething problems it seems to run OK. I only managed to work out cookies after it was launched, and a logout link was created a day after that. But overall, I’d consider it a fairly successful first project in PHP. The URL to follow if you’d like to make a prediction is http://gedanken.we.bs/wordpress/predictions/

Being not very (or even remotely) interested in Football probably didn’t help, but the writing of this did alert me to some nice things about web programming: a lot of different languages are at your disposal all at once. Javascript if commonly used in conjunction with PHP to optimise user interfaces (UIs) and java applets with parameters, generated using PHP, passed are the best way I am cognisant of to display anything dynamic – no I haven’t yet delved into Flash. Apart from these, it is possible to write some scripts in Perl, although it has to be admitted that it sucks at life. Odd that that page is a CGI script… Another nice thing is the fact that server-side scripting can be audaciously typed straight into a page, making security so much less of a headache. Theoretically one can write passwords in plaintext in the script and have it still fairly secure – *theoretically* – Although getting cavalier about security tends not to be a good idea.

By far the worst part of my experience coding this was the discovery that PSPad, a program I’ve had on my machine all this time but haven’t realised its potential PHP-wise, is an awesome editor for PHP. Oh well, bye then Notepad.

Advertisements

One Response to Fruits of my Labour

  1. kirk says:

    Why did you scrub out the name on the .jpg?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: