%option explicit%>
<%
'VP-ASP 6.08 - removed parameter from shopcheckadmin so users with limited access can use this page
ShopCheckAdmin ""
'*******************************
' Version 6.50 Supports adds, deletes, updates
' Display fields in one record of one table
' setting field to keyword "NULL" sets field to empty
' March 8, 2004
'*******************************
dim rstemp
dim which
dim idfield
dim dbtable, AddAction, conn, updateaction
dim DeleteAction
Addaction=Request.form("add")
Updateaction=Request.form("update")
Deleteaction=request("delete")
GetInputValues
If DeleteAction<>"" then
DeleteRecord
end if
EditOpenDatabase conn, database,dbtable
If Addaction = "" and Updateaction = "" Then
AdminPageHeader
GenerateForm
AdminPageTrailer
Else
AdminPageHeader
UpdateRecord
GenerateForm
AdminPageTrailer
end if
Shopclosedatabase conn
'************************
Sub GetInputValues
' ID, allows editing a record
which=request("which")
'VP-ASP 6.09 - Precautionary Security Fix
if which > "" then
If not isnumeric(which) then
shoperror "ID must be numeric"
end if
end if
idfield=request("idfield")
dbtable=request("table")
ValidateTable
End Sub
'
Sub ValidateTable
'********************************************
'See if user has access to this table
Dim UserTables, i
dim tablecount
if getconfig("XRestrictAdminTables")<>"Yes" then exit sub
UserTables=GetSess("UserTables")
If Isnull(UserTables) then
exit sub
end if
if UserTables="" then
exit Sub
else
UserTables=split(GetSess("UserTables"),",",-1,1)
end if
tablecount=ubound(UserTables)
for i = 0 to tablecount
if ucase(dbtable)=ucase(Usertables(i)) then
exit sub
end if
next
dbtable=""
end sub
Sub GenerateForm
dim sqltemp
sqltemp="select * from " & dbtable
if which <> "" then
sqltemp=sqltemp & " where " & idfield & "=" & which
end if
'debugwrite sqltemp
set rstemp=conn.execute(sqltemp)
DisplayForm
rstemp.close
set rstemp=nothing
gethelp dbtable
end Sub
'****************************
Sub DisplayForm()
dim keyvalue, howmanyfields, i, fieldname, fieldvalue, fieldtype, fieldtypenum
howmanyfields=rstemp.fields.count -1
%>
| <%shopwriteheader ucase(left(dbtable, 1)) & right(dbtable, len(dbtable) - 1) & " Setup"%> |
<%
dim returntopage
select case dbtable
case "orders"
returntopage = "shopa_displayorders.asp"
case "projects"
returntopage = "shopa_projectdisplay.asp"
case "registrant"
returntopage = "shopa_giftregdisplay.asp"
case "oitems"
'VP-ASP 6.50 - remember where to go back to
returntopage = "shopa_displayoitems.asp?orderid=" & request("which")
case "tblaccess"
returntopage = "shopa_menu_control.asp"
case else
returntopage= "shopa_editdisplay.asp?which=" & which & "&table=" & dbtable & "&idfield=" & idfield
end select
response.write " | "
response.write "| Back To " & ucase(left(dbtable, 1)) & right(dbtable, len(dbtable) - 1) & " | "
%>
|
<%'VP-ASP 6.09 - restore error display
if serror > "" then%>
| <%shopwriteerror sError%> |
<%end if%>
<%
GenerateDisplayHeader "Basic Information"
GenerateDisplayBodyHeader
response.write "