php homework: totally forgot to commit the different stages of this project, so here's the whole thing.