Post by Todge on Jan 25, 2006 10:28:27 GMT -8
If you have your board open to guests, this code will help prevent spamming... Put it in your Global Footer.
This line in the code...
if(message.value.match(/[û|Ô|±|à|Á|å|É|ù|È|ý|Ð|Ç|Ê|Ö|ú|º|Ï|Ð]/))
checks any post being posted by a Guest for those characters, remove or add any you think are relevent, keeping the characters between || marks...
To ensure that all users of your forum have JavaScript enabled, put this at the very bottom of your Global Header...
And put this at the very top of your Global Footer...
<script type="text/javascript">
<!--
/*
Help prevent spamming (Global Footer)
by Todge
Copyright © 2006
Please keep this header intact
*/
if(document.postForm && pb_username=='Guest')
{
var posting = document.getElementsByTagName('input');
var message=document.getElementsByTagName('textarea');
for(m=0; m<message.length; m++)
{
if(message[m].name=='message')
message=message[m];
break;
}
for(p=0; p<posting.length; p++)
{
if(posting[p].value=='Post Reply')
{
posting[p].onclick=function()
{
if(message.value.match(/[û|Ô|±|à|Á|å|É|ù|È|ý|Ð|Ç|Ê|Ö|ú|º|Ï|Ð]/))
{
message.value='';
alert('No spamming!!!');
}
}
}
}
}
// -->
</script>
This line in the code...
if(message.value.match(/[û|Ô|±|à|Á|å|É|ù|È|ý|Ð|Ç|Ê|Ö|ú|º|Ï|Ð]/))
checks any post being posted by a Guest for those characters, remove or add any you think are relevent, keeping the characters between || marks...
To ensure that all users of your forum have JavaScript enabled, put this at the very bottom of your Global Header...
<!-- Ensure JS is enabled.. DO NOT USE THIS CODE WITHOUT THE RELEVENT FOOTER CODE!! -->
<div id="forum" style="display: none">
And put this at the very top of your Global Footer...
<!-- Ensure JS is enabled -->
</div>
<div id="jsMessage"><center><font size="4">Please enable JavaScript to access this forum<br /><br /></font></center></div>
<script type="text/javascript">
<!--
// show forum and hide JS message
document.getElementById('forum').style.display='';
document.getElementById('jsMessage').style.display='none';
// -->
</script>