<%
DIM addtitle, adddate, addimage, addstory, processtype, editid, ShowConn, rsList, strSQL, bodytext, deleteid
deleteid = Request.QueryString("deleteid")
addtitle = Request.Form("title")
adddate = Request.Form("fdate")
addimage = Request.Form("image")
addstory = Request.Form("story")
processtype = Request.Form("type")
editid = Request.Form("editid")
IF adddate = "" THEN adddate = DATE
IF addtitle = "" THEN addtitle = "News added " & adddate
IF addimage = "" THEN addimage = "NONE"
IF addstory = "" THEN addstory = "Please Check Back Soon For Updates."
'********** DELETE **********
IF deleteid <> "" THEN
Response.Write "NEWS ENTRY DELETED. ID: " & deleteid & "
This page will update automatically or you may return to the Admin Page by clicking here."
Set ShowConn = Server.CreateObject("ADODB.Connection")
ShowConn.open info_db
Set rsList = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM news WHERE id = " & deleteid
rsList.Open strSQL, ShowConn, 1, 3, &H0001
rsList.delete
rslist.Close
Set rsList = Nothing
ShowConn.Close
Set ShowConn = Nothing
%>
<%
ELSE
'************ ADD RECORD **********
IF processtype = "addnews" THEN
Set ShowConn = Server.CreateObject("ADODB.Connection")
ShowConn.open info_db
Set rsList = Server.CreateObject("ADODB.Recordset")
strSQL = "news"
rsList.Open strSQL, ShowConn, 1, 3, &H0002
rsList.AddNew
rsList("title") = addtitle
rsList("image") = addimage
rsList("story") = addstory
rsList("dateadded") = adddate
rsList.Update
rslist.Close
Set rsList = Nothing
ShowConn.Close
Set ShowConn = Nothing
%>The Following Information Has been added to the database:
Title:
<%=addtitle%>
Date to start:
<%=adddate%>
Image:
<%=addimage%>
Story: <%bodytext = Replace(addstory, chr(10), "
")
Response.Write bodytext%>
<%
Response.Write "
This page will update automatically or you may return to the Admin Page by clicking here."
ELSE
'************** EDIT RECORD **********
Set ShowConn = Server.CreateObject("ADODB.Connection")
ShowConn.open info_db
Set rsList = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM news WHERE id = " & editid
rsList.Open strSQL, ShowConn, 1, 3, &H0001
rsList("title") = addtitle
rsList("image") = addimage
rsList("story") = addstory
rsList("dateadded") = adddate
rsList.Update
rslist.Close
Set rsList = Nothing
ShowConn.Close
Set ShowConn = Nothing
%>The Following Information Has been updated to the database:
Title:
<%=addtitle%>
Date to start:
<%=adddate%>
Image:
<%=addimage%>
Story Body:
<%bodytext = Replace(addstory, chr(10), "
")
Response.Write bodytext%>
<%
Response.Write "
This page will update automatically or you may return to the Admin Page by clicking here."
END IF
END IF%>