Exercise : Unsafe Cookie (by Shiny Yang)

The following page unsafe.php (source) is a mockup of a badly written user login page. The programmer implemented the login page poorly because of a misunderstanding about cookies. Without peeking at the source, figure out the following:

Exercise Solution