block server ip disclosure
# support-forum
c
is it possible to block server ip disclosure without regex and much false positives? i tried this i found on the internet:
Copy code
c++
stock IsIp(const texto_ip[])
{
    new count;
    for (new i = 0, j = strlen(texto_ip); i < j; i++) {
        if(texto_ip[i] > 47 && texto_ip[i] < 58) {
            count++;
        }
        if(count > 5) {
            return 1;
        }
    }
    return 0;
}
but a lot of innocents got kicked with this function...
f
that just checks if a string contains more than 5 numeric characters, which is useless as it will match sentences like "I have 200,000 dollar". If you want to detect ip addresses with any level of accuracy you need Regex. Also be aware that servers can use DNS names such as "play.myserver.com:7777" which will not be matched by a Regex that is purely looking for ip addresses.
4 Views