<% Sub Script_Error(message) 'shouldnt ever be needed if the ui provided is used Response.Redirect "ui_index.asp?msg=" & message Response.End 'just to be sure :) End Sub Sub zAdd_News() zobjRS.Open "news", zobjConn, adOpenForwardOnly, adLockOptimistic, adCmdTable zobjRS.AddNew zobjRS("PostedDate") = Now zobjRS("DateStamp") = Year(Date) & Right("0"&Month(Date),2) & Right("0"&Day(Date),2) zobjRS("PostedBy") = z1_UserID zobjRS("Title") = zstrTitle zobjRS("Content") = zstrContent zobjRS("Category") = zintCategory zobjRS.Update zobjRS.Close End Sub Sub zEdit_News() Dim zintEditPost zintEditPost = Trim(Request.Form("postid")) zstrSQL = "SELECT news.Title, news.Content FROM news WHERE news.PostID LIKE " & zintEditPost zobjRS.Open zstrSQL, zobjConn, adOpenForwardOnly, adLockOptimistic, adCmdText If Not zobjRS.EOF Then zobjRS("Title") = zstrTitle zobjRS("Content") = zstrContent zobjRS.Update End If zobjRS.Close End Sub Dim zstrAutoUrl,zstrSmilies 'user options zstrAutoUrl = Request.Form("autoparseurl") zstrSmilies = Request.Form("parsesmilies") If LCase(zstrAutoUrl) = "yes" Then zstrAutoUrl = True Else zstrAutoUrl = False End If If News_AllowSmilies And LCase(zstrSmilies) = "yes" Then zstrSmilies = True Else zstrSmilies = False End If Dim zintCategory zintCategory = Trim(Request.Form("category")) If zintCategory = "" Or Not IsNumeric(zintCategory) Then zintCategory = 1 'default category Else zintCategory = CInt(zintCategory) End If Dim zstrTitle,zstrContent zstrTitle = Trim(Request.Form("title")) zstrContent = Trim(Request.Form("content")) '-- check title -- If zstrTitle = "" Then Call Script_Error("Post has no title") ElseIf Len(zstrTitle) > 150 Then Call Script_Error("Title too long - must be 150 characters or less.") End If '-- check content -- If zstrContent = "" Then Call Script_Error("Post has no content") End If '-- prepare post for database -- If News_UseLanguageFilter Then zstrTitle = zFilter_Language(zstrTitle) zstrContent = zFilter_Language(zstrContent) End If zstrTitle = Server.HTMLEncode(zstrTitle) zstrContent = Server.HTMLEncode(zstrContent) zstrContent = zFilter(zstrContent,zstrAutoUrl,News_AllowUBB,zstrSmilies,News_AllowImages) Dim zobjRS Set zobjRS = Server.CreateObject("ADODB.Recordset") '-- the brain -- Dim zstrUpdateAction zstrUpdateAction = LCase(Trim(Request.Form("updateaction"))) If zstrUpdateAction = "add" Then Call zAdd_News() ElseIf zstrUpdateAction = "edit" And z1_AccessLevel > 0 Then Call zEdit_News() End If Set zobjRS = Nothing zobjConn.Close Set zobjConn = Nothing If AutoGenerateFile Then 'file autogen Server.Execute "File_news.asp" End If If AutoGenerateHeadlines Then 'headlines autogen Server.Execute "File_xml_head.asp" End If Response.Redirect "ui_index.asp?msg=database updated" %>