% Dim updatedetails updatedetails = request("updatedetails") if not updatedetails = "true" then if session("loginok")="true" then response.redirect("/onlinestore/loginmenu.asp") end if end if %>
Step 1. Login <% Dim rsCountry set rsCountry = server.CreateObject("adodb.recordset") Dim Countrypk Dim Personpk Dim bUpdate Const defaultcountry=241 Personpk = request("Personpk") if isnumeric(Personpk) then Personpk = cint(Personpk) if Personpk > 0 then bUpdate = true else bUpdate = false end if else bUpdate = false end if Dim section section = lcase(trim(""&request("section"))) select case section case "addupdate" '----------------------------------------------- 'testoutput(section) Dim bAllOK bAllOK = true 'Do the checks checkfieldfilled(Request("BillSurname")) checkfieldfilled(Request("BillCity")) checkfieldfilled(Request("BillProvince")) checkfieldfilled(Request("BillCompany")) checkfieldfilled(Request("BillCountryNo")) checkfieldfilled(Request("BillPostCd")) checkfieldfilled(Request("BillDialcode")) checkfieldfilled(Request("BillPhone")) checkfieldfilled(Request("PhysAddress1")) checkfieldfilled(Request("PhysSurname")) checkfieldfilled(Request("PhysCity")) checkfieldfilled(Request("PhysProvince")) checkfieldfilled(Request("PhysCompany")) checkfieldfilled(Request("PhysCountryNo")) checkfieldfilled(Request("PhysJobTitle")) checkfieldfilled(Request("PhysPostCd")) checkfieldfilled(Request("PhysDialcode")) checkfieldfilled(Request("PhysPhone")) checkfieldfilled(Request("Password")) checkfieldfilled(Request("Passwordcheck")) if bAllOK then Dim bUsernameUsed bUsernameUsed = false 'testoutput(bupdate) if bupdate then 'edit and update 'Compare the existing username with the request.username Dim bUsernameSame bUsernameSame = true csql = "select username from person where pk = "&session("userpk") rs.open csql, objconn if not(rs.eof and rs.bof) then if trim(lcase(rs("username")))<>trim(lcase(request("username"))) then bUsernameSame = false end if end if rs.close 'If different then check the request.username against the database if not bUsernameSame then csql = "select count(username) as users from person where username = '"&request("username")&"'" rs.open csql, objconn if rs("users")>0 then bUsernameUsed = true end if rs.close end if if not bUsernameUsed then csql = "update person set PhysCountryNo="&checkSQL(Request("PhysCountryNo"),"numeric")&",BillCountryNo="&checkSQL(Request("BillCountryNo"),"numeric")&",Username="&checkSQL(Request("Username"),"string")&",Password="&checkSQL(Request("Password"),"string")&",BillTitle="&checkSQL(Request("BillTitle"),"string")&",BillFirstname="&checkSQL(Request("BillFirstname"),"string")&",BillSurname="&checkSQL(Request("BillSurname"),"string")&",BillInitial="&checkSQL(Request("BillInitial"),"string")&",BillCompany="&checkSQL(Request("BillCompany"),"string")&",BillJobtitle="&checkSQL(Request("BillJobtitle"),"string")&",BillAddress1="&checkSQL(Request("BillAddress1"),"string")&",BillAddress2="&checkSQL(Request("BillAddress2"),"string")&",BillAddress3="&checkSQL(Request("BillAddress3"),"string")&",BillCity="&checkSQL(Request("BillCity"),"string")&",BillProvince="&checkSQL(Request("BillProvince"),"string")&",BillPostCd="&checkSQL(Request("BillPostCd"),"string")&",BillDialcode="&checkSQL(Request("BillDialcode"),"string")&",BillPhone="&checkSQL(Request("BillPhone"),"string")&",BillFax="&checkSQL(Request("BillFax"),"string")&",BillEmail="&checkSQL(Request("BillEmail"),"string")&",BillWebsite="&checkSQL(Request("BillWebsite"),"string")&",PhysTitle="&checkSQL(Request("PhysTitle"),"string")&",PhysFirstname="&checkSQL(Request("PhysFirstname"),"string")&",PhysSurname="&checkSQL(Request("PhysSurname"),"string")&",PhysInitial="&checkSQL(Request("PhysInitial"),"string")&",PhysCompany="&checkSQL(Request("PhysCompany"),"string")&",PhysJobtitle="&checkSQL(Request("PhysJobtitle"),"string")&",PhysAddress1="&checkSQL(Request("PhysAddress1"),"string")&",PhysAddress2="&checkSQL(Request("PhysAddress2"),"string")&",PhysAddress3="&checkSQL(Request("PhysAddress3"),"string")&",PhysCity="&checkSQL(Request("PhysCity"),"string")&",PhysProvince="&checkSQL(Request("PhysProvince"),"string")&",PhysPostCd="&checkSQL(Request("PhysPostCd"),"string")&",PhysDialcode="&checkSQL(Request("PhysDialcode"),"string")&",PhysPhone="&checkSQL(Request("PhysPhone"),"string")&",PhysFax="&checkSQL(Request("PhysFax"),"string")&",PhysEmail="&checkSQL(Request("PhysEmail"),"string")&",PhysWebsite="&checkSQL(Request("PhysWebsite"),"string")&",UpgradePCYN="&checkSQL(Request("UpgradePCYN"),"boolean")&",AutoCadVersion="&checkSQL(Request("AutoCadVersion"),"string")&",ExistingUserYN="&checkSQL(Request("ExistingUserYN"),"boolean")&",SpamYN="&checkSQL(Request("SpamYN"),"boolean")&",Comments="&checkSQL(Request("Comments"),"string")&",PreferedCorresMethod="&checkSQL(Request("PreferedCorresMethod"),"string")&",SpecialInstructions="&checkSQL(Request("SpecialInstructions"),"string")&",SpecialExpertise="&checkSQL(Request("SpecialExpertise"),"string")&",SoftwareResellerYN="&checkSQL(Request("SoftwareResellerYN"),"boolean") & ",DteAdded=" & checkSQL(now(),"date") & " where pk = "&personpk objconn.execute(csql) end if 'testoutput(csql) else 'Check that the username selected does not already exist. csql = "select count(username) as users from person where username = '"&request("username")&"'" rs.open csql, objconn if rs("users")>0 then bUsernameUsed = true end if rs.close if not bUsernameUsed then 'add csql = "insert into person (PhyscountryNo,BillCountryNo,Username,Password,BillTitle,BillFirstname,BillSurname,BillInitial,BillCompany,BillJobtitle,BillAddress1,BillAddress2,BillAddress3,BillCity,BillProvince,BillPostCd,BillDialcode,BillPhone,BillFax,BillEmail,BillWebsite,PhysTitle,PhysFirstname,PhysSurname,PhysInitial,PhysCompany,PhysJobtitle,PhysAddress1,PhysAddress2,PhysAddress3,PhysCity,PhysProvince,PhysPostCd,PhysDialcode,PhysPhone,PhysFax,PhysEmail,PhysWebsite,UpgradePCYN,AutoCadVersion,ExistingUserYN,SpamYN,Comments,PreferedCorresMethod,SpecialInstructions,SpecialExpertise,SoftwareResellerYN,DteAdded) values ("&checkSQL(Request("PhyscountryNo"),"numeric")&","&checkSQL(Request("BillCountryNo"),"numeric")&","&checkSQL(Request("Username"),"string")&","&checkSQL(Request("Password"),"string")&","&checkSQL(Request("BillTitle"),"string")&","&checkSQL(Request("BillFirstname"),"string")&","&checkSQL(Request("BillSurname"),"string")&","&checkSQL(Request("BillInitial"),"string")&","&checkSQL(Request("BillCompany"),"string")&","&checkSQL(Request("BillJobtitle"),"string")&","&checkSQL(Request("BillAddress1"),"string")&","&checkSQL(Request("BillAddress2"),"string")&","&checkSQL(Request("BillAddress3"),"string")&","&checkSQL(Request("BillCity"),"string")&","&checkSQL(Request("BillProvince"),"string")&","&checkSQL(Request("BillPostCd"),"string")&","&checkSQL(Request("BillDialcode"),"string")&","&checkSQL(Request("BillPhone"),"string")&","&checkSQL(Request("BillFax"),"string")&","&checkSQL(Request("BillEmail"),"string")&","&checkSQL(Request("BillWebsite"),"string")&","&checkSQL(Request("PhysTitle"),"string")&","&checkSQL(Request("PhysFirstname"),"string")&","&checkSQL(Request("PhysSurname"),"string")&","&checkSQL(Request("PhysInitial"),"string")&","&checkSQL(Request("PhysCompany"),"string")&","&checkSQL(Request("PhysJobtitle"),"string")&","&checkSQL(Request("PhysAddress1"),"string")&","&checkSQL(Request("PhysAddress2"),"string")&","&checkSQL(Request("PhysAddress3"),"string")&","&checkSQL(Request("PhysCity"),"string")&","&checkSQL(Request("PhysProvince"),"string")&","&checkSQL(Request("PhysPostCd"),"string")&","&checkSQL(Request("PhysDialcode"),"string")&","&checkSQL(Request("PhysPhone"),"string")&","&checkSQL(Request("PhysFax"),"string")&","&checkSQL(Request("PhysEmail"),"string")&","&checkSQL(Request("PhysWebsite"),"string")&","&checkSQL(Request("UpgradePCYN"),"boolean")&","&checkSQL(Request("AutoCadVersion"),"string")&","&checkSQL(Request("ExistingUserYN"),"boolean")&","&checkSQL(Request("SpamYN"),"boolean")&","&checkSQL(Request("Comments"),"string")&","&checkSQL(Request("PreferedCorresMethod"),"string")&","&checkSQL(Request("SpecialInstructions"),"string")&","&checkSQL(Request("SpecialExpertise"),"string")&","&checkSQL(Request("SoftwareResellerYN"),"boolean")&","&checkSQL(now(),"date")&")" objconn.execute(csql) 'Set the session variables session("loginok")=true csql = "select pk from person where Username = '"&Request("Username")&"' and password = '"&Request("Password")&"'" rs.open csql, objconn if not (rs.eof and rs.bof) then session("username")=Request("Username") session("userpk")=rs("PK") end if rs.close end if end if end if 'bAllOK if not bUsernameUsed then 'redirect to the product page response.Redirect("/onlinestore/loginmenu.asp") else 'Error message saying that they can't use the username. %>The username you selected has already been used. Please click back and enter another username<% end if function checkfieldfilled(cField) '----------------------------- if not len(trim(cField))>0 then bAllOK = false %>
You did not fill in all the required fields. Please go back and check these fields <% end if checkfieldfilled=cField '----------------------------- end function end select %>
<%if not updatedetails = "true" then%>Existing clients login here
New clients please enter your details
<% else %>Update your details
<% end if%>Note: When your order is placed, multiple copy discount will be implemented on the following screen as a discount amount.
<%if bupdate then
csql = "select * from person where pk = "&personpk
rs.open csql, objconn
end if%>
<%
if bupdate then
rs.close
end if
%>