%
Option Explicit
Response.Buffer = True
Response.Expires = 0
%>
<%
Dim sValidMsg
Dim fValid
fValid = True
Function ValidateField(sFieldValue, sFieldType)
Dim bFieldIsOkay
' defaut it to true
bFieldIsOkay = True
' go to the field name to validate the entry
sFieldType = LCase(sFieldType)
If InStr(1, sFieldType, "password") > 0 Then
If Len(sFieldValue) < 4 Then bFieldIsOkay = False
End If
If InStr(1, sFieldType, "name") > 0 Then
If Len(sFieldValue) = 0 Then bFieldIsOkay = False
End If
If InStr(1, sFieldType, "email") > 0 Then
If Len(sFieldValue) < 5 Then
bFieldIsOkay = False
Else
If Instr(1, sFieldValue, " ") <> 0 Then
bFieldIsOkay = False
Else
If InStr(1, sFieldValue, "@") < 2 Then
bFieldIsOkay = False
Else
If InStrRev(sFieldValue, ".") < InStr(1, sFieldValue, "@") + 2 Then
bFieldIsOkay = False
End If
End If
End If
End If
End If
If InStr(1, sFieldType, "address") > 0 Then
If Len(sFieldValue) = 0 Then bFieldIsOkay = False
End If
If InStr(1, sFieldType, "city") > 0 Then
If Len(sFieldValue) = 0 Then bFieldIsOkay = False
End If
If InStr(1, sFieldType, "state") > 0 Then
If Len(sFieldValue) <> 2 Then bFieldIsOkay = False
End If
If InStr(1, sFieldType, "zip") > 0 Then
If Len(sFieldValue) <> 5 And Len(sFieldValue) <> 10 Then
response.write(sFieldValue)
bFieldIsOkay = False
End If
End If
if InStr(1, sFieldType, "nr") > 0 then
bFieldIsOkay = True
end if
'response.write mid(sFieldType, len(sFieldType)-1, len(sFieldType)-1)
if mid(sFieldType, len(sFieldType)-1, 1) = "_" then
bFieldIsOkay = True
end if
ValidateField = bFieldIsOkay
End Function
If (Request.QueryString("action") = "send") Then
dim field, strField
For Each Field in Request.Form
If ValidateField(Request.Form(Field), Field) = False Then
fValid = false
strField = replace(Field, "_", " ")
strField = replace(strField, "NR", " ")
strField = mid(strField, 1, instr(strField, "^")-1)
strField = UCase(Left(strField, 1)) & LCase(Mid(strField, 2))
sValidMsg = strField & " incorrectly entered."
'dictFields.Add LCase(Field), True
exit for
End If
Next
' End If
If (fValid = True) Then
If (SendEmail = False) Then
fValid = False
sValidMsg = sValidMsg & " Please enter a valid Email address."
Else
Response.Redirect "thanks.html"
End If
End If
End If
%>
<%
Function SendEmail()
Dim sMsg, aMsg(50)
Dim iLen, iCount
dim field, strField, iMsg
For iCount = 0 to 50 step 1
aMsg(iCount) = ""
Next
For Each Field in Request.Form
strField = replace(Field, "_", " ")
if inStr(UCase(strField), "SUBMIT") = 0 then
strField = replace(strField, "NR", "")
strField = UCase(Left(strField, 1)) & LCase(Mid(strField, 2))
if instr(strField, "^") > 0 then
iMsg = 0
iMsg = cInt(right(strField,len(strField)-instr(strField,"^")))
strField = mid(strField, 1, instr(strField, "^")-1)
aMsg(iMsg) = strField & ":"
iLen = 25 - len(strField)
For iCount = 1 to iLen step 1
aMsg(iMsg) = aMsg(iMsg) & " "
Next
aMsg(iMsg) = aMsg(iMsg) & request.form(field) & vbCrlf
else
sMsg = sMsg & strField & ":"
iLen = 25 - len(strField)
For iCount = 1 to iLen step 1
sMsg = sMsg & " "
Next
sMsg = sMsg & request.form(field) & vbCrlf
end if
end if
Next
For iCount = 50 to 0 step -1
if aMsg(iCount) <> "" then
sMsg = aMsg(iCount) & sMsg
end if
Next
Dim oMail, Conf, Flds
Set oMail = CreateObject("CDO.Message")
Set Conf = CreateObject("CDO.Configuration")
Set Flds = Conf.Fields
Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
Flds.Update
Set oMail.Configuration = Conf
oMail.From = request("Full_Name^1") & " <" & request("Email^5") & ">"
'oMail.To = "SMT Golf "
'oMail.Bcc = "SMT Golf "
oMail.To = request("recipient") '"ciphre1@yahoo.com"
oMail.Subject = "McKees Request"
oMail.TextBody = sMsg
oMail.Send
Set Flds = Nothing
Set oMail = Nothing
Set Conf = Nothing
SendEmail = True
End Function
%>
Myrtle Beach and Columbia SC Movers
Personal Checks
Welcome On Local Moves
We Accept: Mastercard,
Visa, and Amexpress On All Moves