%@LANGUAGE="VBSCRIPT"%>
<%
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
%>
<%
Function CheckCAPTCHA(valCAPTCHA)
SessionCAPTCHA = Trim(Session("CAPTCHA"))
Session("CAPTCHA") = vbNullString
if Len(SessionCAPTCHA) < 1 then
CheckCAPTCHA = False
exit function
end if
if CStr(SessionCAPTCHA) = CStr(valCAPTCHA) then
CheckCAPTCHA = True
else
CheckCAPTCHA = False
end if
End Function
%>
<%
Response.Buffer = True
Dim iMonth, iYear, giorno, archivio
iMonth=Request ("month")
iYear=Request ("year")
if iMonth = "" then iMonth = Month(Now)
sMonth=NameFromMonth(iMonth)
if iYear = "" then iYear = Year(Now)
giorno=request.QueryString("giorno")
archivio=request.QueryString("archivio")
Dim commento_autore
Dim commento_email
Dim commento_testo
Dim blog_id
Dim strEmailSubject
Dim strEmailBody
Dim blnAlreadyPostsed
Dim errore
Dim rs_blog
Dim titolo
Dim strCAPTCHA
If isNull(Request.QueryString("blog_id")) = True Or isNumeric(Request.QueryString("blog_id")) = False Then
Response.redirect "index.asp?month=" & iMonth &"&year=" & iYear &"&giorno=" & giorno & "&archivio="& archivio &""
Else
blog_id = CLng(Request.QueryString("blog_id"))
End If
errore = false
If Trim(Request.form("nome")) = "" Or Trim(Request.form("commento")) = "" Then
errore = true
End If
commento_autore = Request.Form("nome")
commento_email = Request.Form("email")
commento_testo = Request.Form("commento")
'remove html tags
commento_autore = removeAllTags(commento_autore)
commento_email = removeAllTags(commento_email)
commento_testo = removeAllTags(commento_testo)
' UBB code
commento_testo = Replace(commento_testo, "[B]", "", 1, -1, 1)
commento_testo = Replace(commento_testo, "[/B]", "", 1, -1, 1)
commento_testo = Replace(commento_testo, "[I]", "", 1, -1, 1)
commento_testo = Replace(commento_testo, "[/I]", "", 1, -1, 1)
commento_testo = Replace(commento_testo, "[U]", "", 1, -1, 1)
commento_testo = Replace(commento_testo, "[/U]", "", 1, -1, 1)
' link
commento_testo = SPLIT(commento_testo,VbCrLf)
FOR m=0 TO ubound(commento_testo)
parola = SPLIT(commento_testo(m)," ")
FOR i=0 TO ubound(parola)
IF Mid (parola(i),1,7) = "http://" THEN
parola(i)=""&parola(i)&""
END IF
IF Mid (parola(i),1,4) = "www." THEN
parola(i)=""&parola(i)&""
END IF
IF (InStr(parola(i),"@") <> 0) AND (InStr(parola(i),".") <> 0) THEN
parola(i)=""&parola(i)&""
END IF
NEXT
commento_testo(m)=JOIN(parola," ")
NEXT
commento_testo = JOIN(commento_testo,VbCrLf)
commento_testo = Replace(commento_testo, vbCrLf, "
")
' fine format
If blnCookieSet = True Then
If CBool(Request.Cookies("Ublog")("Commenti" & blog_id)) = True Then blnAlreadyPostsed = True
End If
If blnAlreadyPostsed = False AND errore = False Then
strCAPTCHA = Trim(Request.Form("txtCaptcha"))
if strCAPTCHA = Trim(Session("CAPTCHA")) AND Trim(Request.Form("commento_sp")) = "" then 'check to make sure field is blank
strSQL = "INSERT INTO commenti (blog_id,commento_autore,commento_email,data,commento_testo) VALUES ('"&blog_id&"','"&commento_autore&"','"&commento_email&"','"&Now()&"','"&commento_testo&"');"
adoCon.Execute strSQL
If blnCookieSet = True Then
Response.Cookies("Ublog")("Commenti" & blog_id) = True
Response.Cookies("Ublog").Expires = DateAdd("n", 30, Now())
End If
If blnEmail = True Then
set rs_blog = adoCon.execute("SELECT blog_titolo FROM blog WHERE blog_id = " & blog_id & ";")
if not(rs_blog.eof) then
titolo = rs_blog("blog_titolo")
end if
rs_blog.close
set rs_blog= nothing
strEmailSubject = strLangSubjectEmailNewComment
strEmailBody = strLangEmailHi
strEmailBody = strEmailBody & "
" & strLangEmailBodyBlog1 & ""
strEmailBody = strEmailBody & "
" & strLangEmailBodyComment & " " & titolo & ": -"
strEmailBody = strEmailBody & "
" & strLangFormAuthor & ": " & commento_autore
strEmailBody = strEmailBody & "
" & strLangFormEmail & ": " & commento_email
strEmailBody = strEmailBody & "
" & strLangFormComment & ":
" & commento_testo
Dim objCDOMail
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
objCDOMail.From = Ublogname & " <" & emailamministratore & ">"
objCDOMail.To = "<" & emailamministratore & ">"
objCDOMail.Subject = strEmailSubject
objCDOMail.Body = strEmailBody
objCDOMail.BodyFormat = 0
objCDOMail.MailFormat = 0
objCDOMail.Importance = 1
objCDOMail.Send
Set objCDOMail = Nothing
End If
Set adoCon = Nothing
Set strCon = Nothing
Response.Redirect "blog_commento.asp?blog_id=" & blog_id & "&month=" & iMonth &"&year=" & iYear &"&giorno=" & giorno & "&archivio="& archivio &""
else
ErrorMessage = ErrorMessage & "You did not type in the verification info correctly."
Session("ErrorCAPTCHA")=ErrorMessage
Response.Redirect "blog_commento.asp?blog_id=" & blog_id & "&month=" & iMonth &"&year=" & iYear &"&giorno=" & giorno & "&archivio="& archivio &""
End If
End If
%>
![]() |
|
<% = strLangNavAddComment %> ![]()
<% = Date() %>
|
|
![]() |
<% If blnAlreadyPostsed = True Then %> <% = strLangErrorMessageOnlyOneCom %> <% = strLangNavBackPrevPage %> <% Else %> <% = strLangErrorMessageNeedAuthorText %> <% = strLangNavBackPrevPage %> <% End If %> |