Simple Machines Community Forum

SMF Development => Feature Requests => Applied or Declined Requests => Topic started by: edchapman on January 17, 2008, 12:43:03 PM

Title: 10 and Register
Post by: edchapman on January 17, 2008, 12:43:03 PM
I would like a feature that allowed guests to view a determined number of posts per visit or per day, and then require them to register to go any further.
Title: Re: 10 and Register
Post by: rsw686 on January 17, 2008, 01:15:07 PM
Use a SESSION variable and increase it when a post is displayed. If past redirect them to the registration screen. Here's an example of what I use, same concept, but to limit searches to one per 60 seconds.


// Require guests to wait sixty seconds between searches.
if($user_info['is_guest'])
{
$time = time();
if(!isset($_SESSION['last_search']) || ($_SESSION['last_search'] + 60 < $time))
$_SESSION['last_search'] = $time;
else
{
$txt['guest_search_limit'] = preg_replace('/WAIT/', ($_SESSION['last_search'] + 60) - $time, $txt['guest_search_limit']);
fatal_lang_error('guest_search_limit', false);
}
}
Title: Re: 10 and Register
Post by: edchapman on January 21, 2008, 03:42:04 PM
How would I apply that to viewing posts?
Title: Re: 10 and Register
Post by: karlbenson on January 21, 2008, 04:46:36 PM
Do note though this will also limit Search Engine Spiders in the same way.

But do not attempt to give search engine robots unlimited access as that would be contrary to their Terms of Service.