Post by Mithras on Nov 22, 2006 17:34:13 GMT -8
This code basically lets you restrict access to one or more boards/pages/threads until someone views another board/page/thread. There are three variables that need to be set, the first, goTo, is the page that people need to view before viewing the restricted pages. restricted is an array that has all the pages that are restricted until the user visits the goTo page. And finally, forumName is the name of your forum.
Preview
Global Header:
Global Footer:
Preview
Global Header:
<script type="text/javascript">
// Visit One Page to View Others by Mithras
// Do not repost without permission
// Edit this first section
var goTo = 'board=yetanotherboard';
var restricted = [
['board=general'],
['board=another']
];
var forumName = 'Test Site';
// Do not edit below
function setCookie(_name,_value){
document.cookie = _name+"="+escape(_value)+";expires="+(new Date()).toGMTString().replace(/\d{4}/,"2050");
}
function getCookie(_name){
if(document.cookie.match(new RegExp(_name+"=(.+?)($|;)","gi")))
return unescape(RegExp.$1);
return null;
}
if(location.href.match(goTo))
setCookie(goTo,'yes');
else {
for(i=0; i<restricted.length; i++) {
if(location.href.match(restricted[i])) {
if(getCookie(goTo) != 'yes')
document.write('<table width="92%" cellspacing="0" cellpadding="0" align="center"><tr><td valign="top" width="100%"><br /><a href="/index.cgi" class="nav">' + forumName + '</a> :: An Error Has Occurred<br/><table border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="000000" class="bordercolor"><tr><td><table cellpadding="4" cellspacing="1" border="0" width="100%"><tr><td width="100%" class="titlebg" bgcolor="4080B0"><font size="2"><b>An Error Has Occurred</b></font></td></tr><tr><td width="100%" class="windowbg" bgcolor="EFEFEF"><font size="2">You must visit <a href="/index.cgi?' + goTo + '">this page</a> before you are permitted to view the content of this board.</font></td></tr></table></td></tr></table><div style="display:none">');
}
}
}
</script>
Global Footer:
<script type="text/javascript">
document.write('</div>');
</script>