%
Set db = Server.CreateObject("ADODB.Connection")
set rs = server.createObject("ADODB.Recordset")
'
if request("action")="delete" then
%>
Are you sure you want to delete this album and all song listings in it?
">YES NO
<%
end if
if request("action")="deleteconfirmed" then
response.write "Deleting Album... "
db.execute("delete from albums WHERE id='" & request("id") & "'")
response.write "Done.
"
response.write "Deleting Songs (files will not be deleted)... "
db.execute("delete from songs WHERE albumid='" & request("id") & "'")
response.write "Done.
"
end if
if request("action")="" then
rs.open "select * from albums", db
%>
| Artist | Title | Action |
<%
set rs2 = server.createObject("ADODB.Recordset")
do while NOT rs.eof
rs2.open "select * from artists where id='" & rs("artistid") & "' order by id", db
%>
| <%=rs2("artist")%> | <%=replace(rs("title"),"þ","'")%> | ">Edit - ">Delete |
<%
rs2.close
rs.movenext
loop
%>
<%
rs.close
set rs2=nothing
end if
if request("action")="edit" AND request("actionb")="save" then
if len(request("album"))>0 then myAlbum=request("album") else myError="Invalid album ID."
if len(request("artist"))>0 then myArtist=request("artist") else myError="Please enter the artist this album belongs to."
if len(request("Description"))>0 then myDescription=replace(request("Description"),"'","þ") else myError="Please enter a description of the album."
if len(request("Title"))>0 then myTitle=replace(request("Title"),"'","þ") else myError="Please enter a title of the album."
if len(request("Image"))>0 then myImage=replace(request("image"),"'","þ")
if len(request("thumbnail"))>0 then myThumbnail=replace(request("thumbnail"),"'","þ")
if len(request("buylink"))>0 then myBuyLink=request("buylink")
if len(myError)<1 then
response.write "Updating Album... "
db.execute("UPDATE albums SET artistid='" & myArtist & "', title='" & myTitle & "', description='" & myDescription & "', image='" & myImage & "', thumbimage='" & myThumbnail & "', buylink='" & request("buylink") & "' WHERE id='" & myAlbum & "'")
'rs.close
response.write "Done."
x=1
response.write "Updating Songs... "
db.execute("DELETE from songs WHERE albumid='" & myAlbum & "'")
DO until x>=21
if len(request("title" & x))>0 then
db.execute("INSERT into songs (albumid,track,title,listenlink,watchlink,length) VALUES('" & myAlbum & "','" & request("tracknumber" & x) & "','" & replace(request("title" & x),"'","þ") & "','" & request("listenlink" & x) & "','" & request("watchlink" & x) & "','" & request("length" & x) & "')")
else
'x=50
end if
x=x+1
LOOP
response.write "Done."
end if
end if
if request("action")="edit" OR len(myerror)>0 then
if len(myerror)>0 then response.write "Error: " & myError & "
"
if request("actionb")<>"save" then
rs.open "select * from albums WHERE id='" & request("album") & "'", db
if NOT rs.eof then
myAlbum=rs("id")
myArtist=rs("artistid")
myTitle=rs("title")
myDescription=rs("description")
myImage=rs("image")
myThumbnail=rs("thumbimage")
myBuyLink=rs("buylink")
else
response.write "ERROR: Album not found.
"
end if
rs.close
end if
%>
<%
end if
set rs=nothing
db.close
set db=nothing
%>