Fix syntax error
Function name error
Declare $l
Handle errormsg in register.php