Forums

This topic is locked

Problems with Pure Asp Upload

Posted 20 May 2002 17:33:47
1
has voted
20 May 2002 17:33:47 Giampaolo Frongia posted:
Hi, i have created an insert form with UD4 .
Simultanouesly i can send a message for a newsletter with CDONTS, but when apply the Pure ASp Upload 1.5, the newsletter doesn't work. Can you help me please?

There are my code:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../../Connections/connPRODUZIONE.asp" -->
<%
Dim rsMAILING__MMColParam
rsMAILING__MMColParam = "1"
if (Request.Form("chimica_gomma_plastica" <> "" then rsMAILING__MMColParam = Request.Form("chimica_gomma_plastica"
%>
<%
Dim rsMAILING__varMec
rsMAILING__varMec = "1"
if (Request.Form("meccanica_elettronica" <> "" then rsMAILING__varMec = Request.Form("meccanica_elettronica"
%>
<%
Dim rsMAILING__varLegno
rsMAILING__varLegno = "1"
if (Request.Form("legno_arredamento" <> "" then rsMAILING__varLegno = Request.Form("legno_arredamento"
%>
<%
Dim rsMAILING__varMultimedia
rsMAILING__varMultimedia = "1"
if (Request.Form("hitech" <> "" then rsMAILING__varMultimedia = Request.Form("hitech"
%>
<%
Dim rsMAILING__varSanitarie
rsMAILING__varSanitarie = "1"
if (Request.Form("sanitarie" <> "" then rsMAILING__varSanitarie = Request.Form("sanitarie"
%>
<%
Dim rsMAILING__varOdonto
rsMAILING__varOdonto = "1"
if (Request.Form("odontotecnici" <> "" then rsMAILING__varOdonto = Request.Form("odontotecnici"
%>
<%
Dim rsMAILING__varMedicale
rsMAILING__varMedicale = "1"
if (Request.Form("medicale" <> "" then rsMAILING__varMedicale = Request.Form("medicale"
%>
<%
set rsMAILING = Server.CreateObject("ADODB.Recordset"
rsMAILING.ActiveConnection = MM_connPRODUZIONE_STRING
rsMAILING.Source = "SELECT EMAIL FROM dbo.ACCESSO WHERE [CHIMICA - GOMMA - PLASTICA] = '" + Replace(rsMAILING__MMColParam, "'", "''" + "' OR [MECCANICA - ELETTRONICA]= '" + Replace(rsMAILING__varMec, "'", "''" + "' OR [LEGNO - ARREDAMENTO] = '" + Replace(rsMAILING__varLegno, "'", "''" + "' OR [MULTIMEDIALE - HI TECH] = '" + Replace(rsMAILING__varMultimedia, "'", "''" + "' OR [IMPRESE SANITARIE] = '" + Replace(rsMAILING__varSanitarie, "'", "''" + "' OR ODONTOTECNICI = '" + Replace(rsMAILING__varOdonto, "'", "''" + "' OR MEDICALE= '" + Replace(rsMAILING__varMedicale, "'", "''" + "'"
rsMAILING.CursorType = 0
rsMAILING.CursorLocation = 2
rsMAILING.LockType = 3
rsMAILING.Open()
rsMAILING_numRows = 0
%>
<%
' *** Edit Operations: declare variables

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

If (CStr(Request("MM_insert") <> "" Then

MM_editConnection = MM_connPRODUZIONE_STRING
MM_editTable = "dbo.produzione"
MM_editRedirectUrl = "inserok_estero.asp"
MM_fieldsStr = "meccanica_elettronica|value|andamento_settore|value|normative|value|progetti_imprese|value|formazione|value|servizi|value|iniziative_commerciali|value|relazioni_sindacali|value|tipo_appuntamento|value|luogo_appuntamento|value|mese|value|data|value|visibile2|value|nazionale2|value|pubblico2|value|chimica_gomma_plastica|value|legno_arredamento|value|hitech|value|sanitarie|value|medicale|value|odontotecnici|value|varSubject|value|varMessage|value"
MM_columnsStr = "meccanica_elettronica|',none,''|andamento_settore|',none,''|normative|',none,''|progetti_imprese|none,'Y','N'|formazione|',none,''|servizi|',none,''|iniziative_commerciali|none,'Y','N'|relazioni_sindacali|',none,''|tipo_appuntamento|',none,''|luogo_appuntamento|',none,''|mese|',none,''|data|',none,''|visibile|',none,''|nazionale|',none,''|pubblico|',none,''|chimica_gomma_plastica|',none,''|legno_arredamento|',none,''|hitech|',none,''|sanitarie|',none,''|medicale|',none,''|odontotecnici|',none,''|titolo|',none,''|circolare|',none,''"

' 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 & " values (" & MM_dbValues & ""

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

Dim Repeat1__numRows
Repeat1__numRows = -1
Dim Repeat1__index
Repeat1__index = 0
rsMAILING_numRows = rsMAILING_numRows + Repeat1__numRows

While ((Repeat1__numRows <> 0) AND (NOT rsMAILING.EOF))



If (cStr(Request("Submit") <> "" Then
Dim objCDO
Set objCDO = Server.CreateObject("CDONTS.NewMail"
objCDO.From = " " 'Senders Email Address
objCDO.To = (rsMAILING.Fields.Item("EMAIL")
objCDO.Subject = cStr(Request("varSubject")'Email Subject
objCDO.Body = cStr(Request("varMessage") 'Email Message
objCDO.Send() 'send mail
Set objCDO = Nothing 'Clean up your objects!!!


End If

Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsMAILING.MoveNext()
Wend

Response.Redirect("insertok.asp"
End If

End If
%>

Rebel

Reply to this topic