Premetto che sono di ASP ne capisco proprio poco...ho trovato sulla rete una funzione gia fatta per impedire ke sul mio forum vengano inserite delle parolacce...tanto per capirci la funzione che ho trovato è la seguente:
<%
Function badWords(sText)
'alcune parole poco consone, potete aggiungerne quante ne volete
words = Array("cretino","stupido","imbecille","porcapalett a")
stringa = sText
For k = LBound(words) To UBound(words)
stringa = Replace(stringa, words(k), String(Len(words(k)),"*"))
Next
badWords = stringa
End Function
%>
X richiamare la funzione -->
<%
Response.write badWords(Request.Form("NOME_CAMPO_FORM"))
%>
-------------------------------
Qualkuno mi puo' dire come inserire questa funzione nel file asp ke vi metto qua di seguito per controllare i dati immessi nel CAMPO MESSAGGIO DEL MIO FORM ?? ?
<%@LANGUAGE = JScript%>
<%
var id_risposta = new String(Request.Form("id_risposta"));;
var nome = new String(Request.Form("nome"));
var email = new String(Request.Form("email"));
var messaggio = new String(Request.Form("messaggio"));
var data = new Date();
var modificato = data.getDate() + "/" + (data.getMonth() + 1) + "/" + data.getYear() + " " + data.getHours() + "." + data.getMinutes() + "." + data.getSeconds();
if ((nome == "") || (nome == "undefined") || (nome.charAt(0) == " "))
{
Response.Redirect("errore.asp?id=1");
}
if ((messaggio == "") || (messaggio == "undefined") || (messaggio.charAt(0) == " "))
{
Response.Redirect("errore.asp?id=3");
}
var Cn = new ActiveXObject("ADODB.Connection");
var Rs = new ActiveXObject("ADODB.Recordset");
Cn.Open("driver={Microsoft Access Driver (*.mdb)};dbq=" + Server.MapPath("forum.mdb"));
Rs.Open("messaggi",Cn,3,3);
Rs.AddNew();
Rs("id_risposta") = id_risposta;
Rs("nome") = nome;
Rs("mail") = email;
Rs("messaggio") = messaggio;
Rs("modificato") = modificato;
Rs.Update();
Rs.Close();
var AggiornaClick = Cn.Execute("UPDATE messaggi SET risposte = risposte + 1 WHERE id LIKE '" + id_risposta + "'");
var AggiornaDataModifica = Cn.Execute("UPDATE messaggi SET modificato = '" + modificato + "' WHERE id LIKE '" + id_risposta + "'");
Response.Redirect("inserito.asp?id=5");
Cn.Close();
%>
GRAZIE....