PDA

View Full Version : Limit guests to viewing 5 threads max.


Zzed
03-31-2002, 10:00 PM
This hack allows a guest to view 5 threads within the forums. After the 5th
thread, the hack will bring up the error_nopermission_loggedout template
to force them to register with the board.

This hack was requested by frozt and jjj0923.

Templates affected: 0
Files affected: showthread.php and admin/sessions.php
Tables affected: session

How to install this hack:

You need to alter the session table using the following command:

alter table session add visitcount smallint(5) unsigned DEFAULT 0;

The rest of the instructions are in the attached file.

Your comments will be greatly appreciated.

frozt
04-01-2002, 09:34 PM
Thnxz man! its works great i think :-)

Zzed
04-01-2002, 09:36 PM
You're welcome. :)

E
04-01-2002, 09:42 PM
does it re-direct them too register page... im gonna try installing now

Zzed
04-01-2002, 09:44 PM
They get sent to the screen that tells them they need to log in or register. :)

jjj0923
04-01-2002, 11:06 PM
thank you - this is great.

- jeff

Remi
04-02-2002, 12:00 AM
Can't he/she just clear the session and continue browsing!!

Zzed
04-02-2002, 12:04 AM
Originally posted by Remi
Can't he/she just clear the session and continue browsing!! Yes, but I am sure it will get very annoying after a while. :)

Admin
04-02-2002, 04:54 AM
Remi is right, it's only for the current session. :)

Zzed
04-02-2002, 05:49 AM
Unless your cookie times out, or you kill your browser, you won't be able to read another thread.

Admin
04-02-2002, 05:51 AM
You will be able 5 threads every 15 minutes, or whatever the admin set the cookie timeout for. :)

Zzed
04-02-2002, 05:57 AM
Membership has its privileges. :D

kevinsdh
08-27-2002, 01:03 AM
I get parsing errors in "session" when trying to run this on 2.2.6 Please give me a hand to get it right. This is a great hack and I reaaaaallllllllllllyyyyyyy need it! session table altered (visitcount added) and code in both php scripts changed and verified.

Thanks!!!!!!

Matt87
08-27-2002, 01:14 AM
Wouldn't it be better to go to a template that says: "You cannot view any more than 5 threads"? :D

Zzed
08-27-2002, 05:53 PM
Originally posted by Matt87
Wouldn't it be better to go to a template that says: "You cannot view any more than 5 threads"? :D

Yes it would. But I have a few different template sets, and blame this on my laziness, but I used what was already available. ;)

Zzed
08-27-2002, 05:54 PM
Originally posted by kevinsdh
I get parsing errors in "session" when trying to run this on 2.2.6 Please give me a hand to get it right. This is a great hack and I reaaaaallllllllllllyyyyyyy need it! session table altered (visitcount added) and code in both php scripts changed and verified.

Thanks!!!!!!

Please Email me a copy of your sessions.php.

My Email is edwink@seebeyond.com :)

SgtSling
09-01-2002, 08:36 PM
how can this be altered to come up with a different template thanerror_nopermission_loggedout template ?

I want to specify a different template..

amykhar
02-18-2003, 11:34 PM
I thought this was a wonderful idea, and installed it. Then I remembered the googlebot and uninstalled it. I think I need to come back some time when I have a few brain cells working and see if I can't code it so that google and other bots that I like can stay and crawl.

Amy

Cluster One
04-15-2003, 07:22 AM
Is there a way to change the value from say 5 to 10 or 15?

Zzed
04-15-2003, 07:32 AM
Look for all instances of the following code. There are 2 of them:


if($session[visitcount] > 5)


And replace the number 5 with any number you want. ;)

007
05-16-2003, 06:20 PM
Hey would there be any way to base this on an IP basis? So instead of checking for cookies, it would check if the IP had already viewed 5 threads?

Zzed
05-17-2003, 08:04 AM
These visits are remembered per session. A guest does not use a cookie since cookies are given to registered users.
.
And to keep track of visits per IP address, you would need to create a brand new table to keep track of individual IP's and increment their visit count..