Friend... you can do this way:
snip
This seems like a much better way to do it in fact. Though, there are a few modifications I would like to make.
Firstly, the Server IP doesn't have to be inputted manually, and it maybe a pain if the server's IP is dynamic. You can probably just use
$_SERVER['SERVER_ADDR']; as a replacement.
Secondly, AFAIK strpos is a really bad way to detect other IPs as it could return false positives. For example, if this is executed:
if(strpos('abcdefghijklmnopqrstuvwxyz', 'hello') !== false){
//executable code
}
It will run the code inside as the characters in the string 'hello' are within the alphabet, regardless of the order. A better way to go about searching the list would be to turn it into an array and use a foreach loop. You can probably go about doing this by using code similar to this:
foreach(explode("\n", $torList) as $torIP){
if($torIP == $ip){
banned();
}
}
This code splits the list by every new line and cycles through it, trying to match every IP in the list with the current user's IP. If it finds a match, it bans the user.