blink_26
Starting Member
3 Posts |
Posted - 21 November 2002 : 16:06:26
|
Lately my site has become pretty popular, and I find more and more people are linking directly to the fourm..... http:\\www.xyzsite.com\fourm
I enjoy using the forum using the forum as a community meeting place..... but I put a lot of time into the actual site. With people linking directly to the fourm, they bypass all of that and any new changes I spend my time developing.
I couldn't find anything to use, so I wrote a little script.... not sure if there's anything else floating around, but I couldn't find it.
Basicly it looks at where the person has come from..... if they haven't been to the main part of the site yet... it redirects then to the homepage.
So here it is.....
This is a file called "inc_gatekeeper.asp" ---------------------------------------------------------- <% '************************************************************** 'Gatekeeper V1.0 11/20/02 'Written By Jeremy Mann '************************************************************** dim referrer,validreferrer,indexfilelocation ' ---------------- CONFIGURE FOR YOU SITE ------------------ '///////////////////DO Not Write "http:// and use lower case names" ///////////////////// dim validprefixes(3) validprefixes(0) = "xyzsite.com" 'address of your website without www validprefixes(1) = "www.xyzsite.com" ' www address of your website. validprefixes(2) = "111.22.333.444" ' IP address for your website indexfilelocation = "../index.htm" ' This is the location of the hompage file that you wish to redirect to
' //////////////////// DO NOT MODIFY ANYTHING AFTER THIS LINE //////////////////// validprefixes(3) = "127.0.0.1" ' This is for Development on a local machine, and only works on localmachine referrer = Request.ServerVariables("HTTP_REFERER") Referingsite = LCase(left(referrer,InStr(8,referrer,"/"))) validreferrer = 0 For i = 0 to 3 If ("http://"& LCase(validprefixes(i)) &"/" = Referingsite) THEN validreferrer = 1 END IF Next IF validreferrer = 0 THEN Response.Redirect (indexfilelocation) END IF %>
Save file to the main forum directory and edit the values/IP for your site.....
Next on any page you want protected place: <!--#INCLUDE FILE="inc_gatekeeper.asp"-->
just below <!--#INCLUDE FILE="config.asp"-->
So it looks like this: <!--#INCLUDE FILE="config.asp"--> <!--#INCLUDE FILE="inc_gatekeeper.asp"-->
Thats It !!!!
(If you place in config.asp it will protect the whole site but blocks forum popups such as "file uploads" , smile list popups... ect)
|
Edited by - blink_26 on 21 November 2002 16:45:48 |
|