%@ LANGUAGE = "VBScript" ENABLESESSIONSTATE = False %> <% go = Request.QueryString("go") Function ValidateEmailAddress(checkEmail) email = LTrim(RTrim(checkEmail)) at = InStr(2, email, "@") If at = 0 Then ValidateEmailAddress = False Exit Function End If lft = Left(email, at - 1) For i = 1 To Len(lft) a = Mid(lft, i, 1) If Asc(a) < 33 Or Asc(a) > Asc("z") Then ValidateEmailAddress = False Exit Function End If Next dot = InStr(at, email, ".") If dot = 0 Then ValidateEmailAddress = False Exit Function End If middle = Mid(email, at + 1, dot - at - 1) rght = Right(email, Len(email) - dot) If Len(middle) < 2 Or Len(rght) < 2 Then ValidateEmailAddress = False Exit Function End If ValidateEmailAddress = True End Function If go = "send" Then Const adOpenStatic = 3 Const adLockOptimistic = 3 Set cnDZ = Server.CreateObject("ADODB.Connection") ' make sure you create a Microsoft Access System DSN exactly as typed ' below, as it is Case-Sensitive! : cnDZ.Open "Data Source=//nawinfs02/home/users/web/b249/rh.sikh/database/eprodatabase;Provider=Microsoft.Jet.OLEDB.4.0;" myEmail = Request.Form("myEmail") If myEmail <> "" Then If ValidateEmailAddress(myEmail) = True Then Set rsU = Server.CreateObject("ADODB.RecordSet") rsU.Open "TBLNEWSLETTER", cnDZ, adOpenStatic, adLockOptimistic rsU.AddNew rsU.Fields("MY_EMAIL") = myEmail rsU.Fields("THE_DATE") = Now() rsU.Update rsU.Close Set rsU = Nothing 'change this to your domain name: Else Response.Redirect"http://domain.com/" End If End If cnDZ.Close Set cnDZ = Nothing 'change this to your domain name: Response.Redirect"http://domain.com/" Else %>