Switched to PHP for page generation

Cleaned up some code, switched to a basic PHP page generation system.