<% on error resume next dim req,result,campaign, campaign_text campaign = Request.QueryString("pollid") if campaign = empty then campaign = "0" end if campaign_text = GetCampaign() req = Request.ServerVariables.Item("REQUEST_METHOD") if "POST" = req then %> <% function IsValidData() IsValidData = true if Len(Request.Form("Subject")) > 40 then IsValidData = false exit function end if if Len(Request.Form("To")) > 40 then IsValidData = false exit function else if false = IsValidEmail(Request.Form("To")) then IsValidData = false exit function end if end if if Len(Request.Form("From")) > 40 then IsValidData = false exit function else if false = IsValidEmail(Request.Form("From")) then IsValidData = false exit function end if end if if Len(Request.Form("Message")) > 255 then IsValidData = false exit function end if end function function IsValidEmail(Email) dim normal,validButRare set normal = new RegExp normal.Pattern = "^[a-z0-9_\+-]+(\.[a-z0-9_\+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,4})$" set validButRare = new RegExp validButRare.Pattern = "^[a-z0-9,!#\$%&'\*\+/=\?\^_`\{\|}~-]+(\.[a-z0-9,!#\$%&'\*\+/=\?\^_`\{\|}~-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,})$" if normal.Test(Email) then 'Response.Write(Email & ",true
") IsValidEmail = true exit function else if validButRare.Test(Email) then 'Response.Write(Email & ",extrue
") IsValidEmail = true exit function end if end if IsValidEmail = false end function function GetCampaign() dim cs,con cs = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;PORT=3306;DATABASE=voting;UID=mytextreader;PWD=pizda13;" set con = Server.CreateObject("ADODB.Connection") con.Open(cs) set rec = con.Execute("select text from vote_campaign where ix_vote_campaign = "&campaign) GetCampaign = rec.Fields.Item("text") con.Close() end function if IsValidData() then 'check cookie and compare it with answer result = Request.Cookies("spamquestion3455764") if Request.Form("Answer") = result then Set objMessage = CreateObject("CDO.Message") objMessage.Subject = Request.Form("Subject") objMessage.From = Request.Form("From") objMessage.To = Request.Form("To") objMessage.BCC = "soptest@yahoo.com" objMessage.HTMLBody = "

"&Request.Form("Message")&"

Your friend invites you to look at the poll: "&campaign_text&"


Here is the link where you can vote and create your own poll:Independent Polls" objMessage.Send if Err.number = 0 then %> Your message has been sent successfully.<%=Err.Description %> <% else %>
Error:<%=Err.Description %>
Your email cannot be sent.
Try again.
<% end if else 'invalid answer %>
Invalid answer!
Your email cannot be sent.
Try again.
<% end if else 'Invalid data %>
Spam is not allowed!
Your email cannot be sent.
<% end if %> <% else dim a,b,op Randomize a = Int((99 - 0 + 1) * Rnd + 0) b = Int((99 - 0 + 1) * Rnd + 0) op = "+" result = a + b if Rnd >= 0.5 then op = "-" if a < b then dim c c = a a = b b = c end if result = a - b end if 'set cookie Response.Cookies("spamquestion3455764") = result %>
Send This Link To your Friend:
If you would like to send this link to your friend, please use this form. Only one email address is allowed to prevent spam. (I do not collect or share email addresses.)
From: 40
To: 40
Subject: 40
Message: 255
This is the text that will be added to the message:
Your friend invited you to look at the poll: <%=campaign_text %>. Here is the link where you can vote and create your own poll: Independent Polls
<%=a %> <%=op %> <%=b %> = ? - Spam prevention question.
<% end if 'Response.Redirect(Request.ServerVariables("HTTP_REFERER")) %>