Page 1 of 1

Setting max. pageviews per minute

Posted: Mon Aug 14, 2006 9:48 am
by Terriator
I need to limit the amount of pageview a user can have per minute to about 60.

How would I go about doing this? Of course I can make a mysql-solution, but I'm thinking there must be a way that takes less resources than that?

Thanks,
Terriator

Posted: Mon Aug 14, 2006 10:01 am
by feyd
keep a count in sessions maybe?

Posted: Mon Aug 14, 2006 10:10 am
by s.dot
Or cookies (less reliable). Either way you'd have to have a database/storage solution and a user login, or this couldn't really be effective.

[edit] Oh, per minute. Sessions should do the trick.

Code: Select all

<?php
session_start();
if(!empty($_SESSION['pageviews']))
{
   $_SESSION['pageviews'] = $_SESSION['pageviews']+1;
} else
{
   $_SESSION['pageviews'] = 1;
}
?>

Posted: Mon Aug 14, 2006 10:41 am
by Terriator
Yea, I already had that idea. Just wanted to be sure that there wasn't anything less resource taking =) .. I've got to the point where I my server-resources are running away from me =/