%@LANGUAGE="VBSCRIPT"%>
<%
' *** Edit Operations: declare variables
Identity = Request.Form("username")
password=Request.form("password")
if password=Request.Form("password_2") then
MM_editAction = CStr(Request("URL"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Request.QueryString
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables
mess=request.querystring("mess")
if mess<>"" then
message="
Sorry - the logon name of: '" & Identity & "' - has already been taken, please use a different one"
end if
If (CStr(Request("MM_insert")) <> "") Then
set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_kworld_STRING
Recordset1.Source = "SELECT m_id FROM members WHERE m_identity='" & request.form("username") & "'"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 3
Recordset1.Open()
Recordset1_numRows = 0
If NOT Recordset1.EOF then
Recordset1.Close()
response.redirect("register.asp?mess=" & request.form("username"))
else
Recordset1.Close()
end if
MM_editConnection = MM_kworld_STRING
MM_editTable = "members"
MM_editRedirectUrl = "reception.asp"
MM_fieldsStr = "username|value|first_name|value|password|value|family_name|value|street_1|value|m_block_a|value|street_2|value|town|value|county|value|country|value|post_code|value|email|value|m_block_e|value|telephone|value|m_block_t|value|fax|value|web_site|value|category|value|emailme|value"
MM_columnsStr = "m_identity|',none,''|m_firstname|',none,''|m_password|',none,''|m_familyname|',none,''|m_street|',none,''|m_block_a|none,1,0|m_address|',none,''|m_town|',none,''|m_county|',none,''|m_country|',none,''|m_postcode|',none,''|m_email|',none,''|m_block_e|none,1,0|m_telephone|',none,''|m_block_t|none,1,0|m_fax|',none,''|m_website|',none,''|m_category|',none,''|m_emailme|none,1,0"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
' set the form values
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(i+1) = CStr(Request.Form(MM_fields(i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it
If (CStr(Request("MM_insert")) <> "") Then
' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
FormVal = MM_fields(i+1)
MM_typeArray = Split(MM_columns(i+1),",")
Delim = MM_typeArray(0)
If (Delim = "none") Then Delim = ""
AltVal = MM_typeArray(1)
If (AltVal = "none") Then AltVal = ""
EmptyVal = MM_typeArray(2)
If (EmptyVal = "none") Then EmptyVal = ""
If (FormVal = "") Then
FormVal = EmptyVal
Else
If (AltVal <> "") Then
FormVal = AltVal
ElseIf (Delim = "'") Then ' escape quotes
FormVal = "'" & Replace(FormVal,"'","''") & "'"
Else
FormVal = Delim + FormVal + Delim
End If
End If
If (i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End if
MM_tableValues = MM_tableValues & MM_columns(i)
MM_dbValues = MM_dbValues & FormVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ",m_nationality) values (" & MM_dbValues & ",'" & request.form("nationality") & "')"
If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "") Then
Session("MM_Username")= Identity
if request.form("nationality")="JP" then
Response.Redirect("japanese.asp")
else
Response.Redirect(MM_editRedirectUrl)
end if
End If
End If
End If
my_date=day(date()) & "/" & month(date()) & "/" & year(date())
set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_kworld_STRING
Recordset1.Source = "SELECT exhibitions.e_title, exhibitions.e_notes, exhibitions.e_datestart, exhibitions.e_dateend,exhibitions.m_id,exhibitions.g_id, members.m_familyname, members.m_firstname, galleries.g_name,galleries.g_id FROM exhibitions, members,galleries WHERE exhibitions.m_id= members.m_id AND exhibitions.g_id=galleries.g_id AND exhibitions.e_datestart < " & my_date
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 3
Recordset1.Open()
Recordset1_numRows = 0
''------ password matches
end if
%>