If you are seeing this message, it is possible the page did not load properly. Please hit reload/refresh on your browser.
If you still see this message, you probably do not have a browser that supports web standards, although its content is accessible to any browser or Internet device.

Cool Tips & Tricks Cool Tips & Tricks

Help Communities:
Help Forums Bug Base
<< Prev Topic | Next Topic >>
Cool Tips & Tricks ::: Javascript FAQ ::: Block Anon/Guests from viewing a forum
New Topic    Add Reply
Topic: Block Anon/Guests from viewing a forum  (?)  Click to receive email notification of replies Click to stop receiving email notification of replies email this topic to a friend
ezNutrocker

EzNutz
Posts: 75
Posted: 6/12/05 2:57 pm    
Block Anon/Guests from viewing a forum
I took a few scripts and combined them to make this script.

Anyways the idea is pretty simple, I want to prevent guests and anon users from viewing a specific forum. If you think it is okay I thought someone might want to clean it up and post it. So far as I can tell it works just fine.

Disclaimer: Any of these scripts can be bypassed easily by someone with minimal computer experience.

You will also need the EZURL script.

Change the frm21 to the forum number you wish to protect.

Change the www.domain.com/noanon.html to the web page you wish to redirect guests or anonymous viewers to.

Box 1:
  
<script type="text/javascript">
/* BLOCK ANONYMOUS & GUEST FROM VIEWING A SPECIFIC FORUM Based largely on phalenl80 scripts*/
function ProtectForum() {
if ( (!ezPage && !ezQuery ) || ezIsBoard) {
/*Change ezforum number to the one you wish to protect */
if (ezforum == "frm21") {
                        sBlockURL = "www.domain.com/noanon.html";
        ezUser = getUser();
        if (ezUser.indexOf("@") != -1) { ezUser = ezUser.substr(0, ezUser.indexOf("@")); }

        if (ezUser.length > 0) {
        allTables = document.getElementsByTagName("table");
        for (at = 0; at < allTables.length; at++ ) {
        if (allTables.item(at).className == "whosonline") {
        allTables.item(at).id = "whosonline";

        wotd = allTables.item(at).getElementsByTagName("td").item(1);
        if (wotd.innerHTML.indexOf("u" + ezUser + ".") == -1 && wotd.innerHTML.indexOf("login=" + ezUser) == -1) {
        document.location = sBlockURL;
        }
        }
        }
        }
                        if (document.body.innerHTML.indexOf("" + "www.ezboard.com/messages/alert_cookies.html") != -1) {
                                document.location = sBlockURL;
                        }
                        
                }
        }
}

function getUser() {
var ezUser = "";

for ( dl = 0; dl < document.links.length; dl++ ) {
if ( document.links[dl].href.indexOf("showInBoxFolder") != -1 || document.links[dl].href.indexOf("InboxServer") != -1) {
ezUser = document.links[dl].href.match("u([a-zA-Z0-9\@]*)\.(showInBoxFolder|boardRedirectToInboxServer)")[1];
break;
}
}
return (ezUser == "" ? "" : ezUser);
}
/* END PREVENT ANON AND GUEST FROM VIEWING A SPECIFIC FORUM*/
</script> 


Footer Box 4:
  
<script type="text/javascript">
/* PROTECT FORUM */
ProtectForum();
/* END PROTECT FORUM */
</script>



Updated: 4/12/2004 to add better instructions.

Author :: RowBear

Edited by: ezGoalieAunt at: 1/2/07 9:08 pm

  reply to this message

Click to receive email notification of replies Click to stop receiving email notification of replies email this topic to a friend

New Topic    Add Reply

jump to:
Topic Control Image::: Topic Commands
<< Prev Topic | Next Topic >>

Icon Legend

reply button:::Reply to Post Button   edit button:::Edit Post Button  delete button:::Delete Post Button (Moderator Only)

subscribe/unsubscribe to thread button:::Subscribe to Thread Button   email to friend button:::Email to Friend Button  



- Cool Tips & Tricks - Javascript FAQ -

Communitiesezboard Help Communities:

Help Forums Help Forums Bug Base Bug Base





Powered By ezboard® Ver. 7.32
Copyright ©1999-2007 ezboard, Inc.