In the add_user function, you should not be using all of those $_POST variables directly, they should be passed as function arguments, the way you have it limits the use of that function to the specific case. Also you need to escape them all as you do with the $user variable to prevent SQL injection.
You need to create a function to check if the account is active, something like this...
// checks if the given username and password is valid function account_active($user){ $user = mysql_real_escape_string($user); $total = mysql_query("SELECT COUNT(`acc_id`) FROM `account` WHERE `acc_email` = '{$user}' AND `acc_active` = 1"); return (mysql_result($total, 0) == '1') ? true : false; }If that returns true it means the account is active. this check should be performed only id the credentials have been accepted to cut down on queries, so
if (valid_credentials($_POST['username'], $_POST['password']) === false){ $errors[] = 'Email or password is incorect.'; }else if (is_active($_POST['username']) === false){ $errors[] = 'Your account is not active.'; }Start with that and see how far you get.