The main function has two purposes:
With the strings $head and $foot the layout for all pages is centrally defined.
What is shown is controlled via $what2do which indicates which functions should be executed by the switch-case structure.
If $what2do is not set, the default page is shown. In any other case it is checked first whether the user authentificated herself such that $_SESSION['IamGod'] is set - if not the user is redirected to the login.
Function to login/logoff the user.
Special feature is the increasing delay if someone should try to steal the password.
Just to indicate that the pulling of the weather forecast works, this fuctions reads the last line of the weather logfile and shows its values.