%
Dim strVolumeNo, strIssueNo, strTodaysDate, strRestoreText, strProcess, strTempDate, strTempMonth, strTempYear, a, b, c
strProcess = Request.Form("strProcess")
strVolumeNo = Request.Form("strVolumeNo")
strIssueNo = Request.Form("strIssueNo")
if strVolumeNo = "" and strIssueNo = "" then
strVolumeNo = request("vol")
strIssueNo = request("issue")
end if
strTodaysDate = Request.Form("strTodaysDate")
action = request("action")
username = Request.Form("username")
password = Request.Form("password")
if username = "hempstalk" and password="DPaul" then
session("username") = "hempstalk"
session("password") = "DPaul"
end if
if session("username") = "hempstalk" and session("password") = "DPaul" then
if action = "edit" then
if strProcess = "1" then
for I = 1 to Request.Form("strRestoreText").Count
strRestoreText = strRestoreText & Request.Form("strRestoreText")(I)
next
if strTodaysDate = "" or len(strTodaysDate)< 6 then
strTodaysDate = date()
end if
if strVolumeNo = "" then
strVolumeError = 1
end if
if strIssueNo = "" then
strIssueError = 1
end if
if strRestoreText = "" then
strTextError = 1
end if
if strVolumeError = 0 and strIssueError = 0 and strTextError = 0 then
SQLstr = "SELECT * FROM Archives WHERE VolumeNo =" & strVolumeNo & " AND IssueNo =" & strIssueNo
objRS.open sqlstr,objConn,1,3
if not objRS.EOF then
objRS("VolumeNo") = strVolumeNo
objRS("IssueNo") = strIssueNo
objRS("Date") = strTodaysDate
objRS.Update
end if
objRS.Close
SQLstr = "SELECT * FROM Newsletters WHERE VolumeNo =" & strVolumeNo & " AND IssueNo =" & strIssueNo
objRS.open sqlstr,objConn,1,3
if not objRS.EOF then
objRS("VolumeNo") = strVolumeNo
objRS("IssueNo") = strIssueNo
objRS("Text") = strRestoreText
objRS.Update
end if
objRS.Close
Response.Write("
The newsletter was successfully edited.
")
end if
else
SQLstr = "SELECT * FROM Archives WHERE VolumeNo =" & strVolumeNo & " AND IssueNo =" & strIssueNo
objRS.Open SQLstr,objConn,1,3
if not objRS.EOF then
tempDate = objRS("Date")
tempVol = objRS("VolumeNo")
tempIss = objRS("IssueNo")
end if
objRS.Close
SQLstr = "SELECT * FROM Newsletters WHERE VolumeNo =" & strVolumeNo & " AND IssueNo =" & strIssueNo
objRS.Open SQLstr,objConn,1,3
if not objRS.EOF then
tempText = objRS("Text")
end if
%>
<%
objConn.Close
set objConn = nothing
set objRS = nothing
end if
elseif action = "delete" then
SQLstr = "DELETE * FROM Archives WHERE VolumeNo =" & strVolumeNo & " AND IssueNo = " & strIssueNo
objRS.Open SQLstr,objConn,1
SQLstr = "DELETE * FROM Newsletters WHERE VolumeNo =" & strVolumeNo & " AND IssueNo = " & strIssueNo
objRS.Open SQLstr,objConn,1
Response.Write("
The newsletter has been successfully deleted from the database.
")
else
if strProcess = "1" then
for I = 1 to Request.Form("strRestoreText").Count
strRestoreText = strRestoreText & Request.Form("strRestoreText")(I)
next
if strTodaysDate = "" or len(strTodaysDate)< 6 then
strTodaysDate = date()
end if
if strVolumeNo = "" then
strVolumeError = 1
end if
if strIssueNo = "" then
strIssueError = 1
end if
if strRestoreText = "" then
strTextError = 1
end if
if strVolumeError = 0 and strIssueError = 0 and strTextError = 0 then
sqlstr = "SELECT * FROM Archives"
objRS.open sqlstr,objConn,1,3
objRS.AddNew
objRS("VolumeNo") = strVolumeNo
objRS("IssueNo") = strIssueNo
objRS("Date") = strTodaysDate
objRS.Update
objRS.Close
sqlstr = "SELECT * FROM Newsletters"
objRS.open sqlstr,objConn,1,3
objRS.AddNew
objRS("VolumeNo") = strVolumeNo
objRS("IssueNo") = strIssueNo
objRS("Text") = strRestoreText
objRS.Update
objRS.Close
Response.Write("
The newsletter was successfully added to the database.
")
end if
else
SQLstr = "SELECT Max(VolumeNo) AS MaxVolume, Max(IssueNo) AS MaxIssue FROM Archives"
objRS.Open SQLstr,objConn,1
if not objRS.EOF then
strMaxVolume = objRS("MaxVolume")
strMaxIssue = objRS("MaxIssue")
end if
objRS.Close
%>
<%
end if
objConn.Close
set objConn = nothing
set objRS = nothing
end if
else
%>
<%
end if
%>