News:

Wondering if this will always be free?  See why free is better.

Main Menu

10 and Register

Started by edchapman, January 17, 2008, 12:43:03 PM

Previous topic - Next topic

edchapman

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.

rsw686

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);
}
}
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

edchapman

How would I apply that to viewing posts?

karlbenson

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.


Advertisement: