%option explicit%> <% '******************************************************* ' Version 6.50 ' If everyone must login then make them login ' March 26, 2004 ' Oct 10, 2004 do close recordset line 224 '******************************************************* Dim strPassword1 Dim strPassword2 Dim msg, newcust Dim i Dim sAction dim rs ' the database can be used. If you don't display form Dim dbc ' ********************************************************************** ' Set defaults here '********************************************************************** SetSess "CurrentURL","shoploginforce.asp" SetSess "FollowonURL","shopdisplaycategories.asp" ' sAction=Request.form("Action") ' find out if we are being called via submit If saction="" then sAction=Request.form("Action.x") ' find out if we are being called via submit end if Serror=GetSess("Loginerror") ' possible mesage from login SEtSess "Loginerror","" ' error from shop login If sAction = "" Then ' no came from customer logic GetCustomerSessionData DisplayEverything Else sError="" ValidateData() ' need to validate anything, nothing is required if sError = "" Then UpdateOrderInformation ' put in customer and order data 'VP-ASP 6.50 - when customer registers, they should be logged in as well if getconfig("xcustomerrequiresauthorization") = "Yes" then SEtSess "Login","" SEtSess "CustomerID","" SEtSess "Lastname","" shoperror getlang("langauthnotdone") else SetSess "Login",strlastname end if ResponseRedirect GetSess( "FollowonURL") else DisplayEverything end if end if Sub DisplayEveryThing ShopPageHeader ' Normal page header Displayerrors ' any input errors DisplayLoginForm() ' display customer ShopPageTrailer ' Normal page trailer end Sub ' adds to customer table, order table, oitems table Sub UpdateOrderInformation UpdateContact ' add customer to database strCustomerid=GetSess("Customerid") strDiscount=GetSess("CustDiscount") UpdateCustomerSessionData End Sub Sub DisplayLoginForm() AddLogin ' User login form If getconfig("xRestrictedtoExisting")= "Yes" then exit sub ' Outside table Response.Write("
") End Sub Sub ValidateData() 'VP-ASP 6.50 - security fix strFirstname = cleanchars(Request.Form("strFirstname")) strLastname = cleanchars(Request.Form("strLastname")) strAddress = cleanchars(Request.Form("strAddress")) strCity = cleanchars(Request.Form("strCity")) strState = cleanchars(Request.Form("strState")) strPostCode = cleanchars(Request.Form("strPostCode")) strCountry = cleanchars(Request.Form("strCountry")) strCompany = cleanchars(Request.Form("strCompany")) strWebsite = cleanchars(Request.Form("strWebsite")) strPhone = cleanchars(Request.Form("strPhone")) strWorkphone = cleanchars(Request.Form("strWorkphone")) strMobilephone = cleanchars(Request.Form("strMobilephone")) strFax = cleanchars(Request.Form("strFax")) strEmail = cleanchars(Request.Form("strEmail")) strPassword1 = cleanchars(Request.Form("strPassword1")) strPassword2 = cleanchars(Request.Form("strPassword2")) strcustuserid = cleanchars(Request.Form("strcustuserid")) strhearaboutus = cleanchars(Request.Form("hearaboutus")) CustomerGetFields If strFirstname = "" Then sError = sError & getlang("LangCustFirstname") &getlang("LangCustRequired")& "")
end if
end sub
Sub ValidatePassword
Dim rc
if ucase(getconfig("xpassword"))="YES" then
If getconfig("xcustomeruserid")="Yes" then
If strcustuserid = "" Then
sError = sError & getlang("LangAdminusername") &getlang("LangCustRequired")& "
"
End If
end if
If strPassword1 = "" Then
sError = sError & getlang("LangPassword") & "1" &getlang("LangCustRequired")& "
"
exit sub
End If
If strPassword2 = "" Then
sError = sError & getlang("LangPassword") & "2" &getlang("LangCustRequired")& "
"
exit sub
End If
If StrPassword1<>strPassword2 then
SError= SError & getlang("LangPasswordMismatch") & "
"
exit sub
end if
if len(strPassword1) >= 6 then
CheckForDuplicate rc
if rc > 0 then
SError= SError & getlang("LangPasswordDuplicate") & "
"
end if
else
Serror=Serror & getlang("LangPasswordLength") & "
"
end if
end if
End sub
Sub DisplayErrors
if sError<> "" then
shopwriteError SError
Serror=""
end if
end Sub
Sub AddSubmitButton
If Getconfig("xbuttoncontinue")="" then
Response.Write("")
else
Response.Write("")
end if
end sub
Sub CheckForDuplicate (rc)
Dim testsql
dim myconn
SetSess "Login","Force"
OpenCustomerDb myconn
'VP-ASP 6.09 - clean insecure characters from email
sql = "select * from customers where lastname='" & strlastname & "' and password ='" & strpassword1 & "'"
sql = sql & " and email='" & cleanchars(stremail) & "'"
'debugwrite sql
Set rs = myconn.Execute(SQL)
If Not rs.EOF Then
rc=4
else
rc=0
end if
closerecordset rs
shopclosedatabase myconn
SetSess "Login",""
end sub
Sub addInformationTable
response.write "
" & Largeinfofont
Response.Write getlang("LangCustomerPrompt") & "
"
Response.write largeinfoend & "
|
|||
| <% If ucase(getconfig("Xpassword"))="YES" then %> <% else %> <% end if %> | |||