I'm trying to block some IP addresses and IP categories by taking certain action. Right now, I was blocked by It works with full IP address, but if I put To answer your question, use Although it technically resolves your problem, it has other issues because MySQL can not use any index for these comparisons (see). The effect depends on how large the infrared table is, if it has 100 rows, then this can not be a problem, if it has 100,000, then it is probably. To use the wildcard for the blocked table, you must be in the form of a and you will have an indicator on SELECT * where IP = $ _ server ['REMOTE_ADDR'] and if - & gt; Number returns & gt; 0, I redirect the user.
199.90. *. * For example, in the database, how can I match him? Also, what would be the best way to store the IP in the database?
like : Where to replace $ _SERVER ['REMOTE_ADDR'] from
SELECT * blocking (like IP, '*', '%')
like Wildcard is
'*' instead of
'*' , so it changes the asterisks. Percentage I think you're actually
'199.199 %%. % '' , but the above version is for clarity.
FromIP and
TOIP column. Then something will be stored as "199.199. . " just "199.199.000.000" and "199.199.999.999" The query will be:
Where between INIP and TOIP, $ _SERVER ['REMOTE_ADDR']
blocked ( ) IIP, TOIP).
No comments:
Post a Comment