• Page 1 of 1
  • 1
uCause Community » Trash & Archives » Forum » Anti-Spam for forum
Anti-Spam for forum
AnimorphDate: Sunday, 2010-08-29, 9:26 PM | Message # 1
uCause forum Admin
Group: Developer
Messages: 2835
Awards: 73
Status: :-(
This script does not allow the user to send more than one message per 30 seconds (the timeout can be changed).
Installation:

All codes should be put in the general form of the forum.

First connect the functions to work with Cookies, put this code in the head:
Code

Code
<?if($PAGE_ID$='threadpage')?>    
<script type="text/javascript">    
function getCookie(a){var b=document.cookie.match(new RegExp("(?:^|; )"+a.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));return b?decodeURIComponent(b[1]):undefined}function setCookie(b,f,c){c=c||{};var i=c.expires;if(typeof i=="number"&&i){var h=new Date();h.setTime(h.getTime()+i*1000);i=c.expires=h}if(i&&i.toUTCString){c.expires=i.toUTCString()}f=encodeURIComponent(f);var a=b+"="+f;for(var e in c){a+="; "+e;var g=c[e];if(g!==true){a+="="+g}}document.cookie=a}function deleteCookie(a){setCookie(a,null,{expires:-1})};    
</script>    
<?endif?>

Then - the script itself, after $BODY$:

Code
<?if($PAGE_ID$='threadpage')?>    
<script type="text/javascript">    
/*    
* uForum.AntiSpam $USERNAME$ aka. exec    
* 15:23 04.04.2010 ~ KRSK   
*/    

var bts = document.getElementById('frF16');    
bts.onclick = 'setCookie("FrDs", "ddd", {expires: 30})';    
if (!!getCookie("FrDs")) {    
     bts.disabled = true,    
     bts.value = 'including protection from spam',    
     bts.style.width = '200px',    
     btr = document.getElementById('frF17'),    
     er = document.createElement('div'),    
     er.align = 'center',    
     er.innerHTML = 'Minimum interval for sending messages - 30 seconds! Wait and refresh the page.',    
     btr.parentNode.insertBefore(er, btr.nextSibling);    
}    
</script>    
<?endif?>

bts.onclick = 'setCookie ("FrDs", "ddd", (expires: 30))' - here you can set the timeout (in seconds).

 
0 Thanked you For This Useful Post:
KimmyDate: Tuesday, 2010-10-05, 11:56 AM | Message # 2
Member
Group: Senior Members
Messages: 103
Awards: 1
Reputation: 1
Status: :-(
Oh no, its not work sad
I using Google Chrome, its the problem?


http://kimmy.ucoz.com

Message edited by Kimmy - Tuesday, 2010-10-05, 6:50 PM
 
0 Thanked you For This Useful Post:
uCause Community » Trash & Archives » Forum » Anti-Spam for forum
  • Page 1 of 1
  • 1
Search:


"Making uCoz web designs simple and easy to use"
- uCause Developers