%@LANGUAGE="VBSCRIPT"%>
<%
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 rsAddCommenti
Dim commento_autore
Dim commento_email
Dim commento_testo
Dim blog_id
Dim strEmailSubject
Dim strEmailBody
Dim blnAlreadyPostsed
Dim errore
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)
' format 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, "
")
' end format
'Set rsAddCommenti = Server.CreateObject("ADODB.Recordset")
'strSQL = "SELECT TOP 1 commenti.*, blog.blog_titolo FROM blog INNER JOIN commenti ON blog.blog_id = commenti.blog_id WHERE commenti.blog_id = " & blog_id & " ORDER BY commenti.commento_id DESC;"
Set rsAddCommenti = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT commenti.*, blog.blog_titolo FROM blog INNER JOIN commenti ON blog.blog_id = commenti.blog_id WHERE commenti.blog_id = " & blog_id & ""
rsAddCommenti.CursorType = 3
rsAddCommenti.LockType = 3
rsAddCommenti.Open strSQL, strCon
If blnCookieSet = True Then
If CBool(Request.Cookies("Ublog")("Commenti" & blog_id)) = True Then blnAlreadyPostsed = True
End If
blnAlreadyPostsed = false
If blnAlreadyPostsed = False AND errore = False Then
rsAddCommenti.AddNew
Set rsAddCommenti1 = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT commenti.*, blog.blog_titolo FROM blog INNER JOIN commenti ON blog.blog_id = commenti.blog_id WHERE commenti.blog_id = " & blog_id & " order by commenti.commento_id desc"
rsAddCommenti1.Open strSQL, strCon
if rsAddCommenti1.eof then
id = 1
else
id = rsAddCommenti1("commento_id") + 1
end if
rsAddCommenti.Fields("commento_id") = id
rsAddCommenti.Fields("data") = now
rsAddCommenti.Fields("commento_autore") = commento_autore
rsAddCommenti.Fields("commento_email") = commento_email
rsAddCommenti.Fields("commento_testo") = commento_testo
rsAddCommenti.Fields("blog_id") = blog_id
rsAddCommenti.Update
rsAddCommenti.Requery
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
strEmailSubject = strLangSubjectEmailNewComment
strEmailBody = strLangEmailHi
strEmailBody = strEmailBody & "
" & strLangEmailBodyBlog1 & ""
strEmailBody = strEmailBody & "
" & strLangEmailBodyComment & " " & rsAddCommenti.Fields("blog_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
rsAddCommenti.Close
Set rsAddCommenti = Nothing
Set adoCon = Nothing
Set strCon = Nothing
Response.Redirect "blog_commento.asp?blog_id=" & blog_id & "&month=" & iMonth &"&year=" & iYear &"&giorno=" & giorno & "&archivio="& archivio &""
End If
rsAddCommenti.Close
Set rsAddCommenti = Nothing
%>
![]() |
|
<% = strLangNavAddComment %> ![]()
<% = Date() %>
|
|
![]() |
<% If blnAlreadyPostsed = True Then %> <% = strLangErrorMessageOnlyOneCom %> <% = strLangNavBackPrevPage %> <% Else %> <% = strLangErrorMessageNeedAuthorText %> <% = strLangNavBackPrevPage %> <% End If %> |