Secure Facility 7: Door Control

The Door Access Code system was designed so that players could enter the codes from 2 department heads, inside an hour, which would then “unlock” the doors in character, and allow them to throw the dead mans handle, spin the wheels, and press the two additional deadmans handles by the door to open the main bunker doors – killing everyone inside pretty fast from radiation poisoning.  While this sounds like a bad idea once they worked out they were sharing the facility with an unknown alien being some of them get very tempted to use it :)Technically speaking it was a short collection of PHP scripts backending onto SQLite that were made to appear in the main CMS by dint of being in an iframe.  This was from my point of view one of the least exciting options as its all tech I knew, but at the same time it was fun to build it and include its output on the control panel via jQuery stuff :)

For those playing along at home with looking at the source you basically have the following:

  • index.php displays the form to enter details and number of current valid codes
  • validate.php processes input forms to make sure the users username/code are correct
  • util.php contains a bunch of common functions
  • external-door-access.php summarises the current validly entered codes, used by the control panel to include its message at the top.
  • logs.php shows the logs for attempts to validate, which accounts have been tried and when.
  • door.sqlite this stores all the details like users, codes, and attempts for everything else to work off.

So yeah, there you have it, pretty simple form processing, a small thing but effective at what it was made for, you’ll need to poke at the Control Panel to see how it gets included.

My conclusions from this are basically my conclusions from lots of other small tools and scripts I’ve built – any time you’re thinking of storing a little data don’t put it in a text file and write clumsy code to parse it, just put it in an SQLite database, you’ll thank me for it later :)

Leave a Reply