Union Flag
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> AMBsoft UK
AMBsoft UKUnion Flag


Processing, please wait......

 

 

 

 

 

 

 

 

 

 

 

 

Updated 26-08-2008 Copyright © AMBsoft UK

<% Title=Request.Form("Form title") Name = Request.Form("realname") SenderEmail = Request.Form("E-mail") Subject = Request.Form("subject") Recipient = Request.Form("recipient1") & Request.Form("recipient2") & Request.Form("recipient0") CCRecipient = Request.Form("cc-recipient2") & Request.Form("cc-recipient0") & Request.Form("cc-recipient1") Body = "__________________________________________________________" & vbCrLf Body = Body & "Subject: " & Request.Form("subject") & vbCrLf Body = Body & vbCrLf Body = Body & "Name: " & Request.Form("realname") & vbCrLf Body = Body & vbCrLf Body = Body & "Email: " & Request.Form("E-mail") & vbCrLf Body = Body & vbCrLf Body = Body & "email_format: " & Request.Form("email_format") & vbCrLf Body = Body & vbCrLf Body = Body & "Comments: " & Request.Form("comments") & vbCrLf Body = Body & vbCrLf & "__________________________________________________________" & vbCrLf 'initialise objects and variables dim JMail, intComp, strReferer, strServer, strClientIP, strServerIP, blnSpam, blnHTML, intSpam, intPrompt dim proctext, text, fpath, mem1, mem2, fileexist Set JMail = Server.CreateObject("JMail.Message") 'code to check if this page is being called from a another page on the server strReferer = request.servervariables("HTTP_REFERER") strServer = Replace(request.servervariables("SERVER_NAME"), "www.", "") strClientIP = request.servervariables("REMOTE_ADDR") strServerIP = request.servervariables("LOCAL_ADDR") '============= SPAM FILTERS ================ 'Check referrer is on same domain as server intSpam=0 intComp = inStr(strReferer, strServer) If intComp > 0 Then blnSpam = False Else ' Spam Attempt Block blnSpam = True intSpam=1 End If 'Stop anyone using ambsoft.co.uk as their domain name if blnSpam=false then intComp = inStr(SenderEmail, "ambsoft.co.uk") If intComp > 0 Then blnSpam = True if intSpam=0 then intSpam=2 end if Else ' Spam Attempt Block blnSpam = False end if End If 'Stop anyone using mymail-in.net as their domain name if blnSpam=false then intComp = inStr(SenderEmail, "mymail-in.net") If intComp > 0 Then blnSpam = True if intSpam=0 then intSpam=3 end if Else ' Spam Attempt Block blnSpam = False end if End If 'Stop anyone using .info as their domain name if blnSpam=false then proctext = right(SenderEmail, 5) if proctext = ".info" then blnSpam = True if intSpam=0 then intSpam=6 end if Else ' Spam Attempt Block blnSpam = False end if End If 'Check for repeated domain names >2 times on same date if blnSpam=false then intComp = inStr(SenderEmail, "@") proctext=right(SenderEmail,(len(SenderEmail)-intComp)) fpath=Server.MapPath("\") mem1path=fpath & "\data\regone.txt" mem2path=fpath & "\data\regtwo.txt" proctext=date & " " & proctext set fs = CreateObject("Scripting.FileSystemObject") if (fs.fileexists(mem1path)) then set file = fs.OpenTextFile(mem1path, 1) mem1 = file.readall mem1=left(mem1,(len(mem1)-2)) file.Close() if (fs.fileexists(mem2path)) then set file = fs.OpenTextFile(mem2path, 1) mem2 = file.readall mem2=left(mem2,(len(mem2)-2)) file.Close() if mem1=mem2 and mem1=proctext then blnSpam = True if intSpam=0 then intSpam=3 end if end if end if end if if (fs.fileexists(mem1path)) then if (fs.fileexists(mem2path)) then set file = fs.getFile(mem2path) file.delete end if set file = fs.OpenTextFile(mem1path, 1) mem1 = file.readall mem1=left(mem1,(len(mem1)-2)) file.Close() set file = fs.CreateTextFile(mem2path, True) file.WriteLine(mem1) file.close() end if set file = fs.CreateTextFile(mem1path, True) file.WriteLine(proctext) file.Close() end if 'Check for repeated visitor IP addresses >2 times on same date if blnSpam=false then ip_address = Request.ServerVariables("HTTP_X_FORWARDED_FOR") if ip_address = "" then ip_address = Request.ServerVariables("REMOTE_ADDR") end if fpath=Server.MapPath("\") mem1path=fpath & "\data\regipone.txt" mem2path=fpath & "\data\regiptwo.txt" ip_address=date & " " & ip_address set fs = CreateObject("Scripting.FileSystemObject") if (fs.fileexists(mem1path)) then set file = fs.OpenTextFile(mem1path, 1) mem1 = file.readall mem1=left(mem1,(len(mem1)-2)) file.Close() if (fs.fileexists(mem2path)) then set file = fs.OpenTextFile(mem2path, 1) mem2 = file.readall mem2=left(mem2,(len(mem2)-2)) file.Close() if mem1=mem2 and mem1=ip_address then blnSpam = True if intSpam=0 then intSpam=4 end if end if end if end if if (fs.fileexists(mem1path)) then if (fs.fileexists(mem2path)) then set file = fs.getFile(mem2path) file.delete end if set file = fs.OpenTextFile(mem1path, 1) mem1 = file.readall mem1=left(mem1,(len(mem1)-2)) file.Close() set file = fs.CreateTextFile(mem2path, True) file.WriteLine(mem1) file.close() end if set file = fs.CreateTextFile(mem1path, True) file.WriteLine(ip_address) file.Close() end if 'Check for HTML in body of message if blnSpam=false then intComp = inStr(Body, " 0 Then blnHTML = True if intSpam=0 then intSpam=10 end if Else intComp = inStr(Body, "www.") If intComp > 0 Then blnHTML = True if intSpam=0 then intSpam=10 end if Else blnHTML = False end if end if end if End If End If '================================================== JMail.From = SenderEmail JMail.Subject = Subject JMail.AddRecipient Recipient JMail.AddRecipientCC CCRecipient JMail.Body = Body JMail.ISOEncodeHeaders = False JMail.EnableCharsetTranslation = False JMail.Priority = 3 JMail.ContentType = "text/plain" JMail.Charset = "ISO-8859-1" JMail.ContentTransferEncoding = "7bit" JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR") JMail.Logging = True 'send mail if NOT blnHTML and NOT blnSpam Then JMail.Send( "smtp.fasthosts.co.uk" ) Else 'Log attempted spamming Dim logtext, strSpam if intSpam=1 then strSpam="Referrer same as Server" elseif intSpam=2 then strSpam="ambsoft.co.uk used as email address" elseif intSpam=3 then strSpam="mymail-in.net used as email address" elseif intSpam=4 then strSpam="Same domain entered twice in succession." elseif intSpam=5 then strSpam="Same IP address twice in succession" elseif intSpam=6 then strSpam=".info used as email address" elseif intSpam=10 then strSpam="HTML code in form" end if fpath=Server.MapPath("\") & "\data\spamlog.txt" logtext = time & " " & date & "," & strReferer & "," & strServer & "," & strClientIP & "," & strServerIP & "," & SenderEmail & "," & strSpam set fs = CreateObject("Scripting.FileSystemObject") set file = fs.OpenTextFile(fpath, 8) file.WriteLine(logtext) file.Close() 'Alert via email dim lastlog intComp = inStr(SenderEmail, "@") proctext=date & " " & right(SenderEmail,(len(SenderEmail)-intComp)) fpath=Server.MapPath("\") & "\data\registerlog.txt" set fs = CreateObject("Scripting.FileSystemObject") if (fs.fileexists(fpath)) then set file = fs.OpenTextFile(fpath, 1) lastlog = file.ReadAll file.Close() lastlog=left(lastlog,(len(lastlog)-2)) end if if lastlog<>proctext then Set JSpam = Server.CreateObject("JMail.Message") JSpam.From = "register1a@ambsoft.co.uk" JSpam.Subject = "ATTEMPTED SPAM ATTACK ON AMBSOFT UK" JSpam.AddRecipient "info1a@ambsoft.co.uk" JSpam.Body = logtext 'JSpam.Message.ISOEncodeHeaders = False JSpam.Priority = 3 JSpam.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR") JSpam.Logging = True JSpam.Send( "smtp.fasthosts.co.uk" ) 'Log domain set file = fs.CreateTextFile(fpath, True) file.WriteLine(proctext) file.Close() end if End If %>