$user->password = md5($password); $user->active = 3; $user->save(); if (!doEmail($user->username, $password, $user->email)) { throw new Exception('Could not send the activation email. Please contact an admin on the forum, or by email'); } header('Location: index.php?e=6'); exit; } else { // need to check the Activatoin table. $a = new Activation(); $a->getByEmail($email); if ($a->id and !$a->success) { // Good $a->password = md5($password); $a->save(); if (!doEmail($a->username, $password, $a->email)) { throw new Exception('Could not send the activation email. Please contact an admin on the forum, or by email'); } header('Location: index.php?e=6'); exit; } else { throw new Exception('That email address does not exists'); }