%@ Language=VBScript%> <%Option Explicit on error resume next Response.Expires = -100 Response.CharSet = "ISO-8859-1" Response.Buffer = true %> <% ' Default: try to load cookies if error, empty then redirect to Index.asp ' This asp is for ' 0: nothing ' 1: auth users ' 2: add users ' 3: update users ' 4: email password ' 5: clear cookie ' 6: mass email 'Dim isCookie Dim Mode Mode = Request.QueryString("f") dim oEnc set oEnc = Server.CreateObject("GTUtility.Encryption") if Mode = "" then ' try to load cookies and Auth 'isCookie = true AuthUser Request.Cookies("GT")("e"), oEnc.GenPW(Request.Cookies("GT")("password")) set oEnc = Nothing elseif Mode = 1 then ' Auth user 'isCookie = false AuthUser Request.Form("email"), Request.Form("password") elseif Mode = 2 then ' Add user AddUser elseif Mode = 3 then UpdateUser(Session("vPID")) elseif Mode = 4 then ' Email password if isempty(Request.Form("email")) then Response.Redirect("ReqPass.htm") emailpw Request.Form("email") elseif Mode = 5 then ' Clear Cookie and redirect to index2.asp Session.Abandon ClearCookies Response.Redirect("Index2.asp") elseif Mode = 6 then ' Send Mass Email SendMassEmail Request.Form("t"), Request.Form("s"),Request.Form("b") Response.Redirect("../Management/MassMail.asp?d=1") else Response.Redirect("Index2.asp") end if sub SendMassEmail(TestEmail, Subject,Body) if (Subject = "" or Body = "") then response.redirect("../Management/MassMail.asp?d=0") end if Dim oCustomers set oCustomers = Server.CreateObject("GTCustomers.Customer") oCustomers.SendMassEmail trim(TestEmail), trim(Subject),trim(Body) set oCustomers = Nothing end sub sub AuthUser(UserEmail, UserPassword) if (UserEmail = "" or Userpassword = "") then Response.Redirect("index2.asp") end if Dim oUtility ,oCustData,oCustData2 Dim oCustomers ,oResp dim title,Lastname,firstname set oUtility = Server.CreateObject("GTUtility.NewCollection") set oCustData = oUtility.NewCollection() oCustData.Add trim(UserEmail), "email" oCustData.Add trim(UserPassword), "password" set oCustomers = Server.CreateObject("GTCustomers.Customer") set oResp = oCustomers.Authen(oCustData) if Not oResp("error") then ' No error if oResp("passwordvalid") And oResp("emailexists") then ' User exists and correct pw set oCustData2 = oResp("custdata") FirstName = oCustData2("firstname") Lastname = oCustData2("Lastname") Title = oCustData2("title") Session("FullName") = Title & " " & FirstName & " " & Lastname Session("Email") = oCustData2("Email") Session("Rights") = oCustData2("Rights") dim oEnc set oEnc = Server.CreateObject("GTUtility.Encryption") Session("Password") = oEnc.GenEnPW(oCustData2("Password")) set oEnc = Nothing Session("useCookies") = 1 Session("isAuth") = true set oUtility = Nothing set oCustData = Nothing set oResp = Nothing set oCustomers = Nothing setCookies() Response.Redirect("Index2.asp") elseif not oResp("passwordvalid") And oResp("emailexists") then ' User exists but correct pw set oUtility = Nothing set oCustData = Nothing set oResp = Nothing set oCustomers = Nothing Response.Redirect("multiForms.asp?f=5") else ' User does not exists set oUtility = Nothing set oCustData = Nothing set oResp = Nothing set oCustomers = Nothing Response.Redirect("multiForms.asp?f=6") end if else ' Error set oUtility = Nothing set oCustData = Nothing set oResp = Nothing set oCustomers = Nothing Response.Redirect("Index2.asp") end if end sub function AddUser() Dim oUtility Dim oCustData dim oCustData2 Dim oCustomers Dim oResp dim title dim Lastname dim firstname set oUtility = Server.CreateObject("GTUtility.NewCollection") set oCustData = oUtility.NewCollection() oCustData.Add Request.Form("Email") ,"email" oCustData.Add Request.Form("FirstName") ,"firstname" oCustData.Add Request.Form("Lastname") ,"Lastname" oCustData.Add Request.Form("MidName") ,"MidName" oCustData.Add Request.Form("Password") ,"Password" oCustData.Add Request.Form("Title") ,"title" oCustData.Add Request.Form("Address1") ,"address1" oCustData.Add Request.Form("Address2") ,"address2" oCustData.Add Request.Form("Company") ,"Company" oCustData.Add Request.Form("Job") ,"Job" oCustData.Add Request.Form("State") ,"state" oCustData.Add Request.Form("City") ,"city" oCustData.Add Request.Form("Country") ,"country" oCustData.Add Request.Form("PostCode") ,"postcode" oCustData.Add Request.Form("Web") ,"Web" oCustData.Add Request.Form("Phone") ,"phone" oCustData.Add Request.Form("Mobile") ,"Mobile" oCustData.Add Request.Form("Fax") ,"fax" oCustData.Add Request.Form("RecEmail") ,"RecEmail" set oCustomers = Server.CreateObject("GTCustomers.Customer") set oResp = oCustomers.RegisterCustomer(oCustData) if Not oResp("error") then ' No error if oResp("exists") then ' User exists Session("isAuth") = false set oUtility = Nothing set oCustData = Nothing set oResp = Nothing set oCustomers = Nothing Response.Redirect("MultiForms.asp?f=5") else ' Success set oCustData2 = nothing set oUtility = Nothing set oCustData = Nothing set oResp = Nothing Response.Redirect("MultiForms.asp?f=1") end if else ' Error set oUtility = Nothing set oCustData = Nothing set oResp = Nothing set oCustomers = Nothing Response.Redirect("Index2.asp") end if end function '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' function UpdateUser(PID) Dim oUtility,oCustData,oCustData2 Dim oCustomers,oResp dim firstname,Lastname,title set oUtility = Server.CreateObject("GTUtility.NewCollection") set oCustData = oUtility.NewCollection() oCustData.Add PID ,"PID" oCustData.Add Request.Form("Email") ,"email" oCustData.Add Request.Form("FirstName") ,"firstname" oCustData.Add Request.Form("Lastname") ,"Lastname" oCustData.Add Request.Form("MidName") ,"MidName" oCustData.Add Request.Form("Title") ,"title" oCustData.Add Request.Form("Address1") ,"address1" oCustData.Add Request.Form("Address2") ,"address2" oCustData.Add Request.Form("Company") ,"Company" oCustData.Add Request.Form("Job") ,"Job" oCustData.Add Request.Form("Web") ,"Web" oCustData.Add Request.Form("State") ,"state" oCustData.Add Request.Form("Country") ,"country" oCustData.Add Request.Form("City") ,"city" oCustData.Add Request.Form("PostCode") ,"postcode" oCustData.Add Request.Form("Phone") ,"phone" oCustData.Add Request.Form("Mobile") ,"Mobile" oCustData.Add Request.Form("Fax") ,"fax" oCustData.Add Request.Form("RecEmail") ,"RecEmail" set oCustomers = Server.CreateObject("GTCustomers.Customer") set oResp = oCustomers.UpdateCustomer(oCustData) if Not oResp("error") then ' No error if oResp("exists") then ' Email exists set oCustData2 = Nothing set oUtility = Nothing set oCustData = Nothing set oResp = Nothing set oCustomers = Nothing response.redirect("MultiForms.asp?f=5") end if set oCustData2 = oResp("custdata") firstname = oCustData2.item("firstname") Lastname = oCustData2("Lastname") Title = oCustData2("title") Session("FullName") = Title & " " & FirstName & " " & Lastname Session("Email") = oCustData2("Email") Session("Rights") = oCustData2("Rights") Session("isAuth") = true setCookies() set oCustData2 = Nothing set oUtility = Nothing set oCustData = Nothing set oResp = Nothing set oCustomers = Nothing Response.Redirect("UpdatedNotice.htm") else ' Error set oUtility = Nothing set oCustData = Nothing set oResp = Nothing set oCustomers = Nothing Response.Redirect("register.asp") end if end function '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' function emailpw(UserEmail) Dim oUtility,oCustData Dim oCustomers,oResp set oUtility = Server.CreateObject("GTUtility.NewCollection") set oCustData = oUtility.NewCollection() set oUtility = Nothing oCustData.Add trim(UserEmail), "email" set oCustomers = Server.CreateObject("GTCustomers.Customer") oResp = oCustomers.SendPassword(oCustData) if oResp then ' Success set oCustData = Nothing set oResp = Nothing set oCustomers = Nothing Response.Redirect("PassSent.htm") else ' Error set oCustData = Nothing set oResp = Nothing set oCustomers = Nothing Response.Redirect("MultiForms.asp?f=6") end if end function %>