Maybe something like this would work better? Also includes checking the banned usergroup, hopefully it helps or gives you some ideas.
PHP Code:
if ( $chk = $DB_site->query_first ( "SELECT userid, usergroupid FROM user WHERE ipaddress='$ipaddress' ) ) :
if ( $chk['usergroupid'] == 8 ) :
//banned error here
elseif ( $chk['usergroupid'] == 2 ) :
//already registered error
elseif ( $chk['usergroupid'] == 9 ) :
$DB_site->query ( "UPDATE user SET usergroupid=2 WHERE userid=$chk[userid]" ) ;
//redirect here
endif ;
endif ;
Cheers,
g-force2k2