%@ Language=VBScript %>
<%
Option explicit
DIM conn,conString,biogSQL,biogRS,canCreate
//On Error Resume Next
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "DRIVER={Microsoft Access Driver (*.mdb)};" & application("conString")
if request.QueryString("subtype").count > 0 then
//submit request for the bio table.
DIM bgTitle,bgText,modify,bgID
modify = false
if request.queryString("bio").count > 0 then
modify = true
bgID = CInt(request.queryString("bio"))
end if
bgTitle = doubleApostrophe(request.form("biogtitle"))
bgText = doubleApostrophe(request.form("biogtext"))
DIM actionCommand,actionSQL
Set actionCommand = Server.CreateObject("ADODB.Command")
Set actionCommand.ActiveConnection = conn
if modify = false then
actionSQL = "INSERT INTO biog (biog_date,biog_text,biog_title) VALUES "
actionSQL = actionSQL & "('" & Now() & "','" & bgText & "','" & bgTitle & "')"
else
actionSQL = "UPDATE biog set biog_date='" & Now() & "',biog_text='" & bgText & "',biog_title='" & bgTitle & "' WHERE biog_id = " & bgID
end if
actionCommand.CommandText = actionSQL
actionCommand.Execute
end if
biogSQL = "SELECT biog_id,biog_title,biog_date,biog_text FROM biog ORDER BY biog_date DESC"
Set biogRS = conn.Execute(biogSQL)
if StrComp(Session("SessionPermissions"),"admin") = 0 then
canCreate = true
else
canCreate = false
end if
Function doubleApostrophe(stringSingle)
Dim aPos
Dim stringDouble
If Len(stringSingle) = 0 Then Exit Function
aPos = InStr(stringSingle, "'")
While aPos <> 0
stringDouble = stringDouble & Left(stringSingle, aPos) & "'"
stringSingle = Right(stringSingle, Len(stringSingle) - aPos)
aPos = InStr(stringSingle, "'")
Wend
DoubleApostrophe = stringDouble & stringSingle
End Function
%>
About the artist
about
<%
while not biogRS.EOF
%>
<%=biogRS("biog_title")%>
<%=biogRS("biog_date")%>
<% if canCreate = true then %>
">delete | ">modify
<% end if %>