%@LANGUAGE="VBSCRIPT"%>
<% on error Resume Next
Dim conn
Dim rslogin, rsGetMax, strSQL, strButton, struserID, strPass, strMass, rsRegister, strSort, strDate
Dim strConfirm, strName, strCompany, strAddress, strCity, strState, strCountry, strZip, strPhone, strEmail, strFax
strButton=request.form("Send")
strDate=date
select case strButton
case "Register"
call newUser(strMass)
response.end
case "Login"
struserID=request.form("usid")
strPass=request.form("pass")
strSQL = "SELECT * FROM register where usid ='" + struserID + "'"
set conn = Server.CreateObject("adodb.connection")
conn.open "polyman", "polyman", "newpolyman"
set rslogin = Conn.Execute(strSQL)
if (not rslogin.eof) then
if rslogin("pass")<>strPass then
strMass="The Password invalidate, Please try again."
call oldUser(strMass)
response.end
else
Session("UsID")=rslogin("usid")
Session("Country")=rslogin("country")
rslogin.close
set rslogin=nothing
if Session("Page")<>"" then
response.redirect Session("Page")
else
response.redirect "index.asp"
end if
Session("Page")=""
response.end
end if
else
strMass="Did not find the User ID, Please try again."
call oldUser(strMass)
response.end
end if
conn.close
set conn=nothing
response.end
case "Register Now"
set conn = Server.CreateObject("adodb.connection")
conn.open "polyman", "polyman", "newpolyman"
struserID = request.form("usid")
strPass = request.form("pass")
strConfirm = request.form("confirm")
strName = request.form("name")
strCompany = request.form("company")
strAddress = request.form("address")
strCity = request.form("city")
strState=request.form("state")
strCountry = request.form("country")
strZip = request.form("postal")
strPhone = request.form("phone")
strEmail = request.form("email")
strFax=request.form("fax")
if strPass<>strConfirm then
strMass="The both passwords didn't much. Please type again."
call newUser(strMass)
conn.close
set conn=nothing
response.end
end if
strSQL = "SELECT * FROM register where usid ='" + struserID + "'"
set rslogin = Conn.Execute(strSQL)
if (not rslogin.eof) then
strMass="The userID has been used. Please change it."
call newUser(strMass)
else
strSQL = "SELECT max(sortid) FROM register"
set rsGetMax = Conn.Execute(strSQL)
if not isnull(rsGetMax(0)) then
strSort=rsGetMax(0)+1
else
strSort=1
end if
strSQL = "Insert into Register values ('"
strSQL=strSQL & struserID & "','" & strPass & "','"
strSQL=strSQL & strName & "','" & strCompany & "','"
strSQL=strSQL & strAddress & "','" & strCity & "','"
strSQL=strSQL & strState & "','" & strCountry & "','"
strSQL=strSQL & strZip & "','" & strEmail & "','"
strSQL=strSQL & strPhone & "','" & strFax & "', '"
strSQL=strSQL & strDate & "'," & strSort & ")"
Conn.Execute(strSQL)
Session("UsID")=struserID
Session("Country")=strCountry
if Session("Page")<>"" then
response.redirect Session("Page")
else
response.redirect "index.asp"
end if
Session("Page")=""
response.end
end if
conn.close
set conn=nothing
response.end
case else
call oldUser(strMass)
response.end
end select
function oldUser(strMass)
%>
Polyman Plastics Inc.
<% end function
function NewUser(strMass) %>
Polyman Plastics Inc.
<% end function %>