1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
   | <%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If
 
' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
  If condition = "" Then
    MM_IIf = ifFalse
  Else
    MM_IIf = ifTrue
  End If
End Function
%>
<%
If (CStr(Request("MM_insert")) = "IntroVis") Then
  If (Not MM_abortEdit) Then
    ' execute the insert
    Dim MM_editCmd
 
    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_kifdb_STRING
    MM_editCmd.CommandText = "INSERT INTO dbo.Membres (Nom, Prenom, Pseudo, Sexe, Pwd, Email, Avatar, NewsLetter) VALUES (?, ?, ?, ?, ?, ?, ?, ?)" 
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("@P1", 129, 1, 50, Request.Form("Nom")) 
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("@P2", 129, 1, 50, Request.Form("Prenom")) 
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("@P3", 129, 1, 35, Request.Form("Pseudo")) 
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("@P4", 129, 1, 10, Request.Form("Sexe")) 
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("@P5", 129, 1, 25, Request.Form("Pwd"))
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("@P6", 129, 1, 50, Request.Form("Email")) 
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("@P7", 129, 1, 50, Request.Form("Avatar")) 
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("@P8", 129, 1, 3, Request.Form("NewsLetter")) 
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close
 
    ' append the query string to the redirect URL
    Dim MM_editRedirectUrl
    MM_editRedirectUrl = "EnregReussi.asp"
    If (Request.QueryString <> "") Then
      If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
        MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
      Else
        MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
      End If
    End If
    Response.Redirect(MM_editRedirectUrl)
  End If
End If
%> | 
Partager