Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>First, you need to know who they are...</p> <p>For casual users, you can rely on cookies. But if you are having problem with an abuser, then they will simply ignore your attempt to stop them and not send a cookie.</p> <p>There are various levels of knowing "who" someone is.</p> <ol> <li>ID in URL</li> <li>Cookies</li> <li>IP Address</li> </ol> <p>And they can ALL be overcome with different levels of diffulculty...</p> <ol> <li>Way too easy (just spoof a different ID, etc...)</li> <li>Cookies are the same as #1</li> <li>IP addresses are harder to overcome unless you have a botnet or similar</li> </ol> <p>For your case, you should likely block the IP address as it's the only reasonable way for you to get done what you are looking for.</p> <p>--</p> <p>Next, you need to be able to keep track of their connections. <code>iptables</code> in Linux has a way to track the number of connections and block for a specific number of minutes after a certian threshold is reached. </p> <p>Using only PHP, you need to record each hit, and the IP address of that hit. An SQL database would be one of the more efficient ways of doing this.</p> <p>If you don't care about history, then simply (mysql):</p> <pre><code>INSERT INTO HitTable SET IP=..., Visits=1 ON DUPLICATE KEY UPDATE Visits=Visits+1 </code></pre> <p>A background crontab could run a query like this every minute?</p> <pre><code>UPDATE HitTable SET Visits = Visits - 10 DELETE FROM HitTable WHERE Visits &lt; 1 </code></pre> <p>Finally, when a visitor visits, you would check the database table for</p> <pre><code>SELECT Visits&lt;100 WHERE IP=... </code></pre> <p>AND if that returns True, let them in, else block them.</p> <p>Hope this helps a bit.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload