$_POST method request limit
if($_POST['body']) {
//do my stuff
}
But let's say i wanna limit $_POST['body'] access to 100 per user(IP). Every time same user (same IP) access/try $_POST['body']) ir count's him and if limit reached (this time li开发者_运维知识库mit 100) display error message and with that say that he can access to $_POST['body'] after 10 minutes.
First idea came to mind is to use MySQL, log every IP and count there access times. But imagine if site have many visitors how much IP it logs. So, it's possible to do that without mysql ? If yes, please provide script.
If something don't understand, jusk ask, and sorry for english :/
Is using sessions sufficient for you?
if($_POST['body']){
if($_SESSION['counter'] < 100){
//...
$_SESSION['counter']++;
}
}
Keep in mind that a different IP doesn't mean different User. Many users can be behind the same Proxy, giving them all the same IP address.
The only way is to save this server-side, and a database tabe won't grow too much if you clean it up properly.
You could use cookies or sessions (they are cookie-based), but this is client side and people could just delete or alter the cookie.
My first thought would be DB too. Have you tried cookies?
精彩评论