<%
email = ""
password = ""
confirmPassword = ""
ErrorMessage = ""
if request.form <> "" then
email = Request.Form("email")
password = Request.Form("password")
confirmPassword = Request.Form("confirmPassword")
if email="" or password="" then
ErrorMessage = "You must specify both email and password."
end if
if password <> confirmPassword then
ErrorMessage = "Password and confirmation do not match."
end if
if ErrorMessage = "" then
set conn = Server.CreateObject("ADODB.Connection")
conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.Open("C:\WebData\Users.mdb")
set rs = Server.CreateObject("ADODB.recordset")
rs.Open "Select * FROM Users WHERE Email = '" & email & "'", conn
if rs.EOF = true then
sql="INSERT INTO Users (Email,Password,Role)
VALUES ('" & email & "','" & password & "','guest')"
conn.Execute(sql)
Response.Redirect("Default.asp")
else
ErrorMessage = "Email address is already in use."
end if
end if
end if
if ErrorMessage <> "" then
response.write("
" & ErrorMessage & "
")
response.write("
Please correct the errors and try again.
")
end if
%>
Register