Script antispam in tagboard

« Older   Newer »
  Share  
† B.B. †
view post Posted on 29/1/2010, 13:12     +1   -1




Lo sappiamo tutti,lo spam in tagboard è una cosa che dilaga come un'epidemia.Dal vero e proprio spam ovvero quello senza avviso di non-spam,al più comune:

[NO SPAM]E' iniziato il contest alla quale siete iscritti ecc.ecc.

Bene,questo script vi toglierà il problema.Infatti esso permette di bloccare immediatamente tutti i messaggi che hanno link esterni a quelli permessi,inviando un alert [finestra di popup con il testo che sceglierete voi] oppure semplicemente ritornando alla tagboard,senza che esso venga inviato:

Ecco il codice dello script con alert:

SPOILER (click to view)
vanno entrambi inseriti in gestione codici html--->in fondo al sito,sia che scegliate quella con l'alert sia che scegliate quello senza alert


CODICE
<script type="text/javascript">
//Creato da Ltk_Sim per il NewsBoard Forum
var mexnospam = 'No spam in tag!'
urlAllowed = new Array();
urlAllowed [0]="link.circuito.net";
var tagboardv = document.tagboard ? document.tagboard : 0;
if(tagboardv) {
function noSpam() {
var content = tagboardv.ffmsg.value.toLowerCase();
if(content.indexOf("http://") != -1 || content.indexOf("www") != -1)
{
var x=0;
var arrayn = urlAllowed.length;
while(x<arrayn)
{
if(content.indexOf(urlAllowed[x]) != -1)
{
return true;
}
else{
if (x==arrayn-1)
{
alert(mexnospam);
return false;
}
x++;
}
}
}
}
tagboardv.onsubmit = noSpam;
tagboardv.ffmsg.onkeypress = function(e)
{
tagboardv.rem.value=300-tagboardv.ffmsg.value.length;
var submittag = tagboardv.elements;
for(i=0;i<submittag.length;i++)
{
var ind = new function() {this.i = i;}
if(submittag[ind.i].value == "Invia")
{
var submittag = submittag[ind.i];
}
}
valueKey=(isNav) ? e.which : window.event.keyCode;
if(valueKey==13 && (parseInt(tagboardv.rem.value)>=1) ) {
submittag.click();
}
}
}
</script>


Per far comparire un messaggio d'alert diverso,dovrete semplicemente modificare:

var mexnospam = 'No spam in tag!'

in

var mexnospam = 'Messaggio che volete compaia'





Non toccate urlAllowed = new Array();

Dovete invece modificare "link.circuito.net" nel nome del vostro forum,da noi verrebbe ad esempio sherlockholmes.forumcommunity.net ,altrimenti anche un link al vostro forum verrà bloccato :P

Questo invece è lo script antispam senza alert,in modo da far pensare ad un errore del forum:

CODICE
<script type="text/javascript">
//Creato da Ltk_Sim per il NewsBoard Forum
urlAllowed = new Array();
urlAllowed [0]="nomeforum.circuitoforum.net";
var tagboardv = document.tagboard ? document.tagboard : 0;
if(tagboardv) {
function noSpam() {
var content = tagboardv.ffmsg.value.toLowerCase();
if(content.indexOf("http://") != -1 || content.indexOf("www") != -1)
{
var x=0;
var arrayn = urlAllowed.length;
while(x<arrayn)
{
if(content.indexOf(urlAllowed[x]) != -1)
{
return true;
}
else{
if (x==arrayn-1)
{
return false;
}
x++;
}
}
}
}
tagboardv.onsubmit = noSpam;
tagboardv.ffmsg.onkeypress = function(e)
{
tagboardv.rem.value=300-tagboardv.ffmsg.value.length;
var submittag = tagboardv.elements;
for(i=0;i<submittag.length;i++)
{
var ind = new function() {this.i = i;}
if(submittag[ind.i].value == "Invia")
{
var submittag = submittag[ind.i];
}
}
valueKey=(isNav) ? e.which : window.event.keyCode;
if(valueKey==13 && (parseInt(tagboardv.rem.value)>=1) ) {
submittag.click();
}
}
}
</script>


Se volete inserire più di un link,ovvero più di un forum permesso non vi basta che aggiungere:

urlAllowed [1]="link.circuito.net";

cambiando il numero [prima era 0,ora è 1] e il link del forum ovvio.E così via:

urlAllowed [2]="link.circuito.net";

urlAllowed [3]="link.circuito.net";

Potete inoltre anche inserire un css3,che serve a bloccare lo spam anche di coloro che hanno i javascript disabilitati,inseritelo in modifica colori e stili:

SPOILER (click to view)
non ha importanza la posizione,ovvio che non dovete stroncare altri css :D


CODICE
.tag .mainbg a[href ^="http://"] {display:none;}
.tag .mainbg a[href ^="http://link_vostro_forum.circuito_vostro_forum.net"], .tag .mainbg a[href ^="http://www.ripe.net"] {display:inline;}


Qui dovete solamente cambiare "http://link_vostro_forum.circuito_vostro_forum.net" nel link del vostro forum ovvio :P invece
CODICE
http://www.ripe.net]www.ripe.net
va lasciato così com'è.Se volete far si che vi siano le stesse eccezioni,ovvero gli stessi link permessi del codice html,non dovete far altro che inserire questo codice dopo {display:inline;} :

CODICE
.tag .mainbg a[href ^="http://"] {display:none;}
.tag .mainbg a[href ^="http://example.forumfree.net"], .tag .mainbg a[href ^="http://www.ripe.net"], .tag .mainbg a[href ^="example.forumfree.net"], .tag .mainbg a[href ^="http://esempio2.forumfree.net"], .tag .mainbg a[href ^="http://esempio3.forumfree.net"], .tag .mainbg a[href ^="http://google.com"]  {display:inline}


Ovvio che i link devono essere quelli che nell'html vengono dopo urlAllowed[0]=

Molto utile :shifty:

N.B. : Il css3 non è compatibile con alcune versioni di IE
 
Top
~TrAzXoo
view post Posted on 26/3/2011, 20:53     +1   -1




Emh... Dove Si Mette?
 
Top
Sherlock
view post Posted on 27/3/2011, 17:15     +1   -1




Mettilo in Codici HTML - In fondo al forum
 
Top
Mekowna
view post Posted on 12/2/2012, 20:18     +1   -1




Io ho usato quello con l'allert però non funge ho modificato quello che cera da fare quello del messaggio e anche il link...ma nn funge lo stesso mf_opera
 
Top
† B.B. †
view post Posted on 22/3/2012, 14:06     +1   -1




Potresti inserire il tuo codice?
 
Top
4 replies since 29/1/2010, 13:12   697 views
  Share