Interestingly enough, question 5 is actually syntactically correct Perl, but not PHP.
Not a high bar to clear, mind you ;)
When interpreting as PHP however
if(isset($_SESSION['uid']))
header("Location: reg");
}
is either missing an opening bracket or has got one too many closing brackets.