Ecco il codice per l'inserimento delle notizie dal back office

<%@ Language=VBScript %>
<%
Response.Expires = 0
Response.Buffer = True
%>


<%

sOp=cstr("" & request.Form("txtOP"))
lID=clng("0" & request.Form("txtID"))
sData=cstr("" & request.Form("txtData"))
sOre=cstr("" & request.Form("cboOre"))
sTitolo=cstr("" & request.Form("txtTitolo"))
sAutore=trim(cstr("" & request.Form("txtAutore")))
sNotizia=trim(cstr("" & request.Form("txtNotizia")))
sNotizia=replace(sNotizia,"'","''")

select case sOP
case "Aggiungi"
sSQL=" Insert into Notizia(Data,Ore,Titolo,Notizia,autore)" & _
" values('" & sData &"','" & sOre & "','" & sTitolo & "','" & sNotizia & "','" & sAutore & "')"
set DicReturn = Execute_SQL(sSQL)

case "Elimina"
sSQL="delete FROM Notizia WHERE Notizia_id=" & lID
lID=0
set dicReturn = Execute_SQL(sSQL)

case "Modifica"
sSQL=" UPDATE Notizia " & _
" set Data='" & SData &"',"& _
" Ore='" & sOre &"',"& _
" Titolo='" & sTitolo &"',"& _
" Autore='" & sAutore &"',"& _
" Notizia='" & sNotizia &"'"& _
" WHERE Notizia_id=" & lID

set dicReturn = Execute_SQL(sSQL)

case else
sSQL="SELECT * FROM Notizia WHERE Notizia_id=" & lID
set DicReturn = Execute_SQL(sSQL)
if dicReturn.Exists("KO") then
set dicADOError = DicReturn
Err.Raise 1000
else
set rs= dicReturn("OK")
if not(rs.BOF and rs.EOF) then
sData=cstr("" & rs("Data"))
sOre=cstr("" & rs("Ore"))
sTitolo=cstr("" & rs("Titolo"))
sAutore=cstr("" & rs("autore"))
sNotizia=cstr("" & rs("Notizia"))
end if
end if
end select

function Execute_SQL_Forum(sSQL)
On Error Resume next
dim sPathRoot,dicReturn,Conn,dicSQL,rs

set dicReturn = Server.CreateObject("Scripting.Dictionary")
sPathRoot = mid(Request.ServerVariables("PATH_INFO"),1,instr(2 ,Request.ServerVariables("PATH_INFO"),"/"))

set Conn = Server.CreateObject("ADODB.Connection")
set rs = server.CreateObject ("ADODB.Recordset")
set dicSQL = Server.CreateObject("Scripting.Dictionary")

Conn.CursorLocation = 3
Conn.ConnectionString ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/mdb-database/database.mdb") & ";Persist Security Info=False"
Conn.Open

set rs = Conn.Execute(sSQL)
set rs.ActiveConnection = Nothing
if err.number = 0 then
dicSQL.Add "OK",rs
set Conn = Nothing
else
dicSQL.Add "KO", Array(Err.Number, Err.Description, Err.Source)
end if

Conn.Close
set Execute_SQL_Forum = dicSQL
set rs=nothing
set dicReturn=nothing
set Conn=nothing
set dicSQL=nothing
end function


%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex, nofollow" />
<link href="/fckeditor/_samples/sample.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form action="details.asp" method="POST" id="frm" name="frm">
<%
Dim sBasePath
sBasePath = Request.ServerVariables("PATH_INFO")
sBasePath = Left( sBasePath, InStrRev( sBasePath, "/_samples" ) )
sBasePath="/fckeditor/"
Dim oFCKeditor
Set oFCKeditor = New FCKeditor
oFCKeditor.BasePath = sBasePath
oFCKeditor.Value= "" & sNotizia & ""
oFCKeditor.Create "txtNotizia"
%>
</form>
</body>
</html>