Moved session management into a class; made a few other edits (especially, “require” => “require_once”).