There is not a lot to it. What part of it is confusing?
- The if statement? See if
- The condition? That's just a flag that gives true if there are no other users logged in. Count the active logins to see what it should return.
- Printing a normal page? Presumably you already do this.
- Printing an error page? This is the same as a normal page, but with a different message.