A couple of issues.
register_final($username, $email)
The arguments are from Posted Forms. Now $_POST is a superglobal so having those two arguments are just a waste.
echo "name: <input type=\"Text\" maxlength=\"20\" name=\"dusername\">";
Can be this
echo 'name: <input type="Text" maxlength="20" name="dusername">';
Just looks neater to me
function logoff() {
$_SESSION=array();
session_destroy();
}
Could be done easier
function logoff() {
unset$_SESSION['session_name'])
}
session_destroy is better used when you use session_register(); and i dont see it in the script and if you are you shouldnt be using $_SESSION.
Also SQL Injections. It doesnt look like you are trying to prevent those at all, which is a huge security risk.
Best link i know for you on how to prevent for them http://www.sitepoint.com/article/794