%
dim conn 'database connection object
dim rs 'recordset
dim strSQL 'sql query
dim endline
'set endline
endline = chr(10)
'create the connection object
set conn = Server.CreateObject("ADODB.Connection")
'open the connection
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\home\hnt7c211\legacy\iha3skj42as9dh.mdb;"
'create a recordset
set rs = Server.CreateObject("ADODB.Recordset")
if Request.ServerVariables("REQUEST_METHOD") = "POST" then
'check the master password
if not Request.Form("MasterPassword") = "raiders" then
Session("responseString") = "That password is incorrect. " &_
"Return to " &_
"Image Approval"
else
'set the sql statement
strSQL = "SELECT id FROM Images WHERE approved="""""
'set rs properties
rs.LockType = adLockReadOnly
'run the query and save to rs
rs.Open strSQL, conn
'loop through records, updating images
Session("responseString") = ""
dim credit, caption, radio
do while not rs.EOF
radio = Request.Form("radio_" & rs.Fields("id"))
'delete
if radio = "del" then
strSQL = "DELETE * FROM Images WHERE id=" & rs.Fields("id")
conn.Execute strSQL
'update
else
'read fields from form
credit = Request.Form("credit_" & rs.Fields("id"))
caption = Request.Form("caption_" & rs.Fields("id"))
'update database
strSQL = "UPDATE Images SET credit=""" & credit & """, " &_
"caption=""" & caption & """, " &_
"approved=""" & radio & """ WHERE ID=" & rs.Fields("id")
conn.Execute strSQL
end if
'move to the next record
rs.MoveNext
loop
rs.Close
Session("responseString") = "Your changes have been saved to the database.
" &_
"Return to Image Approval"
end if
'redirect to form_submit
Response.Redirect "form_submit.asp"
end if
%>
|
|||||||||||
Legacy Cruise II departs in |
|||||||||||
Home | Register & Vote | History | Attendees | Pictures | Guestbook | Links | Feedback | ||||
|
Account Management
Email Newsletter
Voting Results
Copyright © 2005 Legacy Cruise Productions. All Rights Reserved.