%@ Language=VBScript %>
<%Option Explicit%>
<%'*******************************************************************************
' File: feedback.asp
'
' Purpose: Generates the feedback form for research
'
' J. Vu 01/27/2004 - Initial version.
'*********************************************************************************
Dim strErrMsg,objEmailList,strFrom, strTo, strCc, strBcc, strSubject, strBody,lngImportance,lngMsgFormat,lngMsgEncode,lngAttEncode
Dim strFileName,strProject,strValid,strPName, intCount, strAddr
Dim objCommand,objParameter,rstProjects,strProjectList,rstList,strValues,arrProjects
Call OpenDBConnection()
Set rstProjects = Server.CreateObject("ADODB.Recordset")
Set objCommand = Server.CreateObject("ADODB.Command")
objCommand.ActiveConnection = cnnSQL
objCommand.CommandType = adCmdStoredProc
objCommand.CommandTimeout = 120
objCommand.CommandText = "wwwGetResearchProjects"
rstProjects.Open objCommand, , adOpenStatic, adLockReadOnly
If (Not rstProjects.EOF) Then
While Not rstProjects.EOF
If (rstProjects.Fields("strProject").Value <> "") Then
strProjectList = strProjectList & "" & vbCrLf
strValues = strValues & rstProjects.Fields("strProject").Value & ","
End If
rstProjects.MoveNext
Wend
End If
Set rstProjects = Nothing
Set objCommand = Nothing
Set objParameter = Nothing
Call CloseDBConnection()
strPName = Request("project")
strPName = Replace(strPName,"""",""")
strPName = Replace(strPName,"%20"," ")
If (Not Request.ServerVariables("QUERY_STRING") = "") Then
strValid = False
strValues = Left(strValues,Len(strValues) - 1)
arrProjects = Split(strValues,",")
For intCount = 0 To UBound(arrProjects)
If (strPName = arrProjects(intCount)) Then
strValid = True
End If
Next
If (strValid = False) Then
Session("strErrMsg") = "Error! Activity code does not exist."
Response.Redirect("form.asp")
End If
End If
If (Not(IsEmpty(Request("Submit"))) AND Request.ServerVariables("QUERY_STRING") = "") Then
If (Request("email") = "") Then
strErrMsg = "Please fill in your e-mail address."
ElseIf (Request("project") = "") Then
strErrMsg = "Please select an activity."
ElseIf (Request("comments") = "") Then
strErrMsg = "Please fill in your comments."
Else
Call OpenDBConnection()
Set rstList = Server.CreateObject("ADODB.Recordset")
Set objCommand = Server.CreateObject("ADODB.Command")
objCommand.ActiveConnection = cnnSQL
objCommand.CommandType = adCmdStoredProc
objCommand.CommandTimeout = 120
objCommand.CommandText = "wwwGetResearchEmail"
Set objParameter = objCommand.CreateParameter("@strProject", adVarChar, adParamInput, 50)
objCommand.Parameters.Append objParameter
objCommand.Parameters("@strProject") = Request("project")
rstList.Open objCommand, , adOpenStatic, adLockReadOnly
If (Not rstList.EOF) Then
strTo = rstList.Fields("strEmail").Value
End If
rstList.Close
Set rstList = Nothing
Call CloseDBConnection()
strCc = ""
strBcc = ""
strSubject = Request("project")
strBody = " Name: " & Request("name") & " " & _
" Email: " & Request("email") & " " & _
"Activity: " & strPName & " " & _
"Comments: " & " " & Request("comments")
strFrom = Request("email")
lngImportance = CdoNormal
lngMsgFormat = CdoBodyFormatHTML ' These must be zero so the URL in email is not truncated.
lngMsgEncode = CdoMailFormatMime ' These must be zero so the URL in email is not truncated.
lngAttEncode = CdoEncodingBase64
strFileName = ""
Call SendEmail(strFrom,_
strTo,_
strCc,_
strBcc,_
strSubject,_
strBody,_
lngImportance,_
lngMsgFormat,_
lngMsgEncode,_
lngAttEncode,_
strFileName)
Response.Redirect("thanks.htm")
End If
End If
%>