Prova così...Codice PHP:<%
Dim Nome, Messaggi
nome = Request.Form("nome")
messaggi = Request.Form("messaggi")
If nome = "" Then Response.Write "DEVI INSERIRE IL TUO NOME!"
If messaggi = "" Then Response.Write "DEVI INSERIRE IL MESSAGGIO"
if nome<>"" and messaggi<>"" then
Set objFileSystem = Server.CreateObject("Scripting.FileSystemObject")
filePath = Server.Mappath("badwords_IT.txt")
filePath2 = Server.Mappath("badwords_EN.txt")
if objFileSystem.FileExists(filePath) then
Set objFile = objFileSystem.OpenTextFile(filePath, 1)
'leggo file riga per riga fino alla fine del file
Do While Not objFile.AtEndofStream
words=words&","&objFile.ReadLine
Loop
objFile.Close
Set objFile=Nothing
end if
if objFileSystem.FileExists(filePath2) then
Set objFile = objFileSystem.OpenTextFile(filePath2, 1)
'leggo file riga per riga fino alla fine del file
Do While Not objFile.AtEndofStream
words=words&","&objFile.ReadLine
Loop
objFile.Close
Set objFile=Nothing
end if
Set objFileSystem=Nothing
dim a,b
Function badWords(sText)
stringa = sText
words2=split(words,",")
for k=1 to Ubound(words2)
if words2(k)<>"" and not IsNull(words2(k)) then
l_stringa=0
n=0
asterischi=""
l_stringa=len(words2(k))
for n=1 to l_stringa
asterischi=asterischi&"*"
next
stringa = Replace(stringa, words2(k), asterischi)
end if
Next
badWords = stringa
End Function
a=badWords(request.form("nome"))
b=badWords(request.form("messaggi"))
Set Conn=Server.CreateObject("ADODB.Connection")
strConn="driver={Microsoft Access Driver (*.mdb)}; "
strConn= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath("/mdb-database/messaggi.mdb")&";"
Conn.Open strConn
sql = "SELECT * FROM Messaggix"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, conn ,3,3
'scrittura nuovo record
rs.addnew
rs(1) = a
rs(2) = b
rs.update
' Chiusura del database
rs.Close
set rs = Nothing
conn.Close
set conn = Nothing
response.write "Inserimento avvenuto"
End If
%>

Rispondi quotando