AdMentor homepage

/asp/freeapps/postcardmentor/sendit.asp

<!--#include file="inccard.asp"--> <!--#include file="incgenmail.asp"--> <% ' First of all lets just get all variables Dim nCardId, sNameTo, sNameFrom, sEmailFrom, sText, sBGColor, sTextColor, sEmailTo Dim sOtherId Function Password_GenPass( nNoChars, sValidChars ) ' nNoChars = length of generated password ' sValidChars = valid characters. If zerolength-string ' default is used: A-Z AND a-z AND 0-9 Const szDefault = "abcdefghijklmnopqrstuvxyzABCDEFGHIJKLMNOPQRSTUVXYZ0123456789" Dim nCount Dim sRet Dim nNumber Dim nLength Randomize 'init random If sValidChars = "" Then sValidChars = szDefault End If nLength = Len( sValidChars ) For nCount = 1 To nNoChars nNumber = Int((nLength * Rnd) + 1) sRet = sRet & Mid( sValidChars, nNumber, 1 ) Next Password_GenPass = sRet End Function nCardId = Request.Form("fldAuto") if nCardId = "" Then Response.Redirect "." End If 'Ok... sNameTo = Request.Form("nameto") sNameFrom = Request.Form("namefrom") sEmailFrom = Request.Form("emailfrom") sEmailTo = Request.Form("emailto") sGreeting = Request.Form("greeting") sText = Request.Form("S1") sBGColor = Request.Form("BgColor") sTextColor = Request.Form("TColor") 'Save it to database Dim oRS Set oConn = PostCard_GetDatabaseConn() oConn.Execute "update " & Postcard_GetTablePrefix() & "card set sendcount=sendcount+1 where fldAuto=" & nCardId Set oRS = Server.CreateObject("ADODB.Recordset") If Postcard_GetDatabaseType() = "Access" Then oRS.Open "select fldAuto, cardid, nameto, namefrom, emailto, emailfrom, greeting, otherid, bgcolor, textcolor, stext from " & Postcard_GetTablePrefix() & "createdpostcards where fldAuto=-1 " ,oConn ,adOpenKeyset,adLockOptimistic Else oRS.CursorLocation = adUseClient oRS.Open "select fldAuto, cardid, nameto, namefrom, emailto, emailfrom, greeting, otherid, bgcolor, textcolor, stext from " & Postcard_GetTablePrefix() & "createdpostcards where fldAuto=-1 " ,oConn ,adOpenDynamic,adLockOptimistic End If oRS.AddNew oRS("cardid") = nCardId oRS("nameto") = sNameTo oRS("namefrom") = sNameFrom oRS("emailto") = sEmailTo oRS("emailfrom") = sEmailFrom oRS("greeting") = sGreeting oRS("stext") = sText oRS("bgcolor") = sBGColor oRS("textcolor") = sTextcolor sOtherId = Password_GenPass( 10, "" ) oRS("otherid")= sOtherId oRS.Update Dim IDToSend IDToSend = sOtherId & oRS("fldAuto").Value oRS.Close Set oRS = Nothing oConn.Close Set oConn = Nothing strMsgHeader = sNameFrom & "(" & sEmailFrom & ")" & " has sent you a postcard!" & vbCrLf strMsgHeader = "The address to pick it up is : " & GetPathToPickupScript() & "?cardid=" & IDToSend strMsgFooter = vbCrLf & vbCrLf & "This card was sent and created with the postcardservice at http://www.aspcode.net" Dim sErr sErr = SendEmail( Postcard_GetmailServer(), Postcard_GetmailFrom(), CStr(sEmailTo), sNameFrom & " has sent you a postcard", strMsgHeader & strMsgFooter ) If sErr = "" Then Response.Redirect "thanks.asp" Response.Flush Response.End else ' Message send failure Response.Write ("An error has occurred.<BR>") ' Send error message Response.Write ("The error was " & sErr) End If %>
Privacy policy