%@LANGUAGE="VBSCRIPT"%>
<%
Response.Buffer = True
Dim iMonth, iYear
iMonth=Request ("month")
iYear=Request ("year")
if iMonth = "" then iMonth = Month(Now)
sMonth=NameFromMonth(iMonth)
if iYear = "" then iYear = Year(Now)
Dim blog_id
Dim rsblog
Dim blog_autore
Dim blog_email
Dim blog_titolo
Dim blog_testo
Dim blnComments
Dim strMode
Dim strEmailSubject
Dim strEmailBody
Dim msg
Dim errore
Dim data
Dim ora
Dim giorno
Dim mese
Dim anno
errore = false
strMode = Request.Form("strMode")
if Ublogtype = "closed" then
If Session("admin") = False or IsNull(Session("admin")) = True then
Response.Redirect"login.asp?strMode=" & strMode & ""
End If
end if
If strMode = "edit" Then blog_id = CLng(Request.Form("blog_id"))
If Trim(Request.form("blog_autore")) = "" Or Trim(Request.form("blog_titolo")) = "" Or Trim(Request.form("blog_testo")) = "" Then
errore = true
End If
blog_autore = Request.Form("blog_autore")
blog_email = Request.Form("email")
blog_titolo = Request.Form("blog_titolo")
blog_category = Request.Form("category")
blog_testo = Request.Form("blog_testo")
' format input user and remove html tag
blog_autore = removeAllTags(blog_autore)
blog_email = removeAllTags(blog_email)
blog_titolo = removeAllTags(blog_titolo)
If strMode = "new" AND Ublogtype = "open" Then
blog_testo = removeAllTags(blog_testo)
blog_testo = UBBcode(blog_testo)
else
blog_testo = removemaligno(blog_testo)
End if
blog_testo = Replace(blog_testo, VbCrLf, "
")
data = Request.Form("data")
ora = Request.Form("ora")
blnComments = Request.Form("comments")
giorno = Request.form("giorno")
mese = Request.Form("mese")
anno = Request.Form("anno")
If blnComments = "" Then
blnComments = "False"
end if
If data = "" Then
data = Date()
end if
If ora = "" Then
ora = Time()
end if
If giorno = "" then
giorno = Right(CStr(100+Day(Date)), 2)
else
giorno = Right(CStr(100+giorno), 2)
end if
If mese = "" then
mese = Right(CStr(100+Month(Date)), 2)
else
mese =Right(CStr(100+mese), 2)
end if
If anno = "" then
anno = Year(Date)
end if
'setup blog category total to be updated
Set rsblog = Server.CreateObject("ADODB.Recordset")
strBlogSQL = "SELECT tblCategory.CatID, tblCategory.CatTotal "
strBlogSQL = strBlogSQL & "FROM tblCategory WHERE CatID = "&request("category")
response.write strBlogSQL & "
"
set rsBlogTotal = adoCon.Execute (strBlogSQL)
strCatID= rsBlogTotal("CatID")
strBlogTotal= rsBlogTotal("CatTotal")
strBlogTotal=strBlogTotal+1
rsBlogTotal.Close
set rsBlogTotal=Nothing
Set rsblog = Server.CreateObject("ADODB.Recordset")
If errore = false then
If strMode = "edit" Then
strSQL = "UPDATE blog SET blog_titolo = '"&blog_titolo&"', blog_testo = '"&blog_testo&"', blog_autore = '"&blog_autore&"', blog_email = '"&blog_email&"', data = '"&data&"', ora = '"&ora&"', giorno = '"&giorno&"', mese = '"&mese&"', anno = '"&anno&"', commenti = '"&blnComments&"', blogCategory = "&blog_category&" WHERE blog_id = " & blog_id & ";"
Else
strSQL = "INSERT INTO blog (blog_titolo,blog_testo,blog_autore,blog_email,data,ora,giorno,mese,anno,commenti,blogCategory) VALUES ('"&blog_titolo&"','"&blog_testo&"','"&blog_autore&"','"&blog_email&"','"&data&"','"&ora&"','"&giorno&"','"&mese&"','"&anno&"','"&blnComments&"',"&blog_category&");"
strCatSQL = "UPDATE tblCategory SET catTotal = "&strBlogTotal&" WHERE CatID = " & strCatID & ";"
End If
adoCon.Execute strSQL
If strMode <> "edit" Then
adoCon.Execute strCatSQL
End If
If blnEmail = True AND strMode <> "edit" Then
strEmailSubject = strLangSubjectEmailNewBlog
strEmailBody = strLangEmailHi
strEmailBody = strEmailBody & "
" & strLangEmailBodyBlog1 & ""
strEmailBody = strEmailBody & "
" & strLangEmailBodyBlog2 & ""
strEmailBody = strEmailBody & "
" & strLangFormTitle & ": " & blog_titolo
strEmailBody = strEmailBody & "
" & strLangFormAuthor & ": " & blog_autore
strEmailBody = strEmailBody & "
" & strLangFormEmail & ": " & email
strEmailBody = strEmailBody & "
" & strLangFormText & ":
" & blog_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
If strMode = "edit" then
msg = strLangInfoEditBlog
Response.Redirect "editallblog.asp?msg="& msg &""
Elseif Ublogtype ="open" then
Response.Redirect "index.asp"
Else
msg = strLangInfoInsertBlog
Response.Redirect "editallblog.asp?msg="& msg &""
End If
End If
%>
![]() |
|
<% if strMode= "edit" then %><% = strLangNavEditBlog %> ![]()
<% = data %><% else %><% = strLangSelectNewBlog %> ![]()
<% = Date() %><% end if %>
|
|
![]() |
<% If errore = True Then %> <% = strLangErrorMessageNeedAuthorTitleText %> <% if strMode = "new" then %> <% = strLangNavBackPrevPage %> <% else %> <% = strLangNavBackPrevPage %> <% End If End If %> |