Instead of wasting your resource processing PHP for banned IP, it is better to deny them using .htaccess
c_user like this