Post by Wormopolis on Nov 24, 2008 3:28:11 GMT -8
This will set up a Portal screen that shows to new users and asks them to accept your Forum Rules.
If they decline they get sent somewhere else.
Can also be customized to show to users who have been away for a certain numbers of days, and for user who were recently unbanned.
Portal message is HTML customizable.
Top of main footer if you only want it to appear on main page, or global footer is you want it to appear anywhere they try to get in.
EDIT: fixed a bug that set the admin's cookie to banned when they viewed this code in the footers (durn self matching).
version update: added in default BG and text colors. variables are editable at the top of code.
UPDATES TO THIS CODE FOUND ON wormocodes.proboards.com
If they decline they get sent somewhere else.
Can also be customized to show to users who have been away for a certain numbers of days, and for user who were recently unbanned.
Portal message is HTML customizable.
Top of main footer if you only want it to appear on main page, or global footer is you want it to appear anywhere they try to get in.
<script type="text/javascript">
<!--
/* PortKey v1.1
By Wormopolis
Keep Header intact, Do not repost without permission
*/
//EDIT THESE
var portKeyActive = true; //true if you want it on, false if you dont
var absenceMessage="You been away a long time, here are the basic rules of the site in case you forgot:"
var absenceTime = 30; //number of days someone can be absent before they see portal again
var absenceMonitor = "yes" // yes if you want portal reshown to members who havent been on in a while
// no if you dont.
var bannedMessage="You were recently banned. Perhaps you should look over the site rules again:"
var bannedMonitor = "yes" // yes if you want someone who was recently unbanned to see portal again
// no if you dont
var portalMessage="<font size='4'>Welcome to the Serial Killer Clan Site!</font><br><br><br>";
portalMessage+="<table align='center'><tr><td>Site rules:<br><br>"; //just keep adding to portalMessage
portalMessage+="1. keep spam to a minimum.<br>";
portalMessage+="2. no porn.<br>";
portalMessage+="3. no talk about using/selling illegal substances.<br>";
portalMessage+="4. no advertising of sites relating to rules 2 and 3.<br>";
portalMessage+="5. no one likes a racist.<br>";
portalMessage+="6. we dont really talk about serial killers here that much. its just a clan theme.<br></td></tr></table>";
portalMessage+="<br>If you are ok with these rules, click \"I agree\" below. If you think these are ridiculous and constrictive and totally fascist, please click \"I decline\"<br>";
portalMessage+="I hope to see you on my board!<br>";
var declineURL="http://www.smart-central.com/worms.htm"; //URL of where to send them if they decline
var defaultBG = "000000";
var defaultTxt= "FFFFFF";
//NO FURTHER EDITS SHOULD BE NECESSARY, unless you know what you are doing
function declineFnc() {
window.location=declineURL;
}
function acceptFnc() {
todDate=new Date();
todDate2=todDate.getFullYear()+"-"+todDate.getMonth()+"-"+todDate.getDate();
todDate.setYear(todDate.getFullYear()+1);
document.cookie="portkey="+escape(todDate2)+"; expires="+todDate;
window.location="\index.cgi?";
}
tds=document.getElementsByTagName('td');
for (w=tds.length-1; w>0; w--) {
if (tds[w].width=="100%" && tds[w].className=="windowbg" && !tds[w].getElementsByTagName('form').length) {
fnts=tds[w].getElementsByTagName('font');
if (fnts[0] && fnts[0].size=="2" && fnts[0].innerHTML.match(/Sorry, but you have been banned from this forum./i)) {
todDate=new Date();
todDate.setYear(todDate.getFullYear()+10);
document.cookie="portkey="+escape("banned")+"; expires="+todDate;
portKeyActive=false;
}
}
}
if (pb_username!="Guest" && portKeyActive && !location.href.match(/headersfooters/i)) {
var showPortKey=true;
var banMsg=false;
var expMsg=false;
var noobMsg=false;
if (document.cookie.match(/portkey=([^;]*)/)) {
res=RegExp.$1;
if (res!="banned") {
res=unescape(res);
res=res.split('-');
lastDate=new Date(res[0],res[1],res[2]);
todDate=new Date();
diff=todDate.getTime()-lastDate.getTime();
diff/=(1000*60*60*24);
if (diff>absenceTime) expMsg=true;
} else {
banMsg=true;
}
} else {
noobMsg=true;
}
if ((absenceMonitor=="yes" && expMsg)||(bannedMonitor=="yes" && banMsg)||noobMsg) {
tbs=document.getElementsByTagName('table');
for (a=0;a<tbs.length; a++) {
tbs[a].style.display="none";
}
divs=document.getElementsByTagName('div');
for (a=1;a<divs.length; a++) {
divs[a].style.display="none";
}
document.write("<table align='center' height='400' width='90%' cellpadding='10' class='bordercolor' cellspacing='10'><tr><td>");
document.write("<table align='center' width='100%' height='100%' style='background-color:"+defaultBG+"' cellpadding='0' class='windowbg'><tr><td>");
if (banMsg) document.write(bannedMessage);
if (expMsg) document.write(absenceMessage);
document.write("</td></tr><tr><td><font color="+defaultTxt+">");
document.write(portalMessage);
document.write("</font></td></tr>");
document.write("<tr><td height='10%'><table width='100%' valign='bottom'><tr>");
document.write("<td align='center' width='50%'><input id='acc' type='button'onclick='acceptFnc()'>I ACCEPT</input></td>");
document.write("<td align='center' width='50%'><input id='dec' type='button' onclick='declineFnc()'>I DECLINE</input></td>");
document.write("</tr></table></td></tr>");
document.write("</table>");
document.write("</td></tr></table>");
decBtn=document.getElementById('dec');
}
}
// -->
</script>
EDIT: fixed a bug that set the admin's cookie to banned when they viewed this code in the footers (durn self matching).
version update: added in default BG and text colors. variables are editable at the top of code.
UPDATES TO THIS CODE FOUND ON wormocodes.proboards.com