<%
'Save entered username and password
Username = Request.Form("txtUsername")
Password = Request.Form("txtPassword")
Password2 = Request.Form("txtPassword2")
Firstname = Request.Form("txtFirstname")
Lastname = Request.Form("txtLastname")
AEM = Request.Form("txtAEM")
EmailAddress=Request.Form("txtEmailAddress")
'check if password not match with password2
if Password <> Password2 Then
Response.Redirect("login.asp?login=pass2failed")
end if
'Check if username and password are entered
if Username = "" then Response.redirect("login.asp?login=createnamefailed")
if Password = "" then Response.Redirect("login.asp?login=createpassfailed")
if FirstName = "" then Response.Redirect("login.asp?login=createfnamefailed")
if LastName = "" then Response.Redirect("login.asp?login=createlnamefailed")
if AEM = "" then Response.Redirect("login.asp?login=createaemfailed")
'if EmailAddress = "" then Response.Redirect("login.asp?login=creatednew")
'Build connection
set conn = server.CreateObject ("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath ("users.mdb")
set rs = server.CreateObject ("ADODB.Recordset")
'Open all records
rs.Open "SELECT * FROM userlist", conn, 3, 3
'Check if username doesn't already exist
do while not rs.EOF
if rs("username")=Username then
set rs=nothing
set conn=nothing
Response.Redirect("login.asp?login=createnamefailed")
end if
rs.MoveNext
loop
'Add a record
rs.AddNew
'Put username and password in record
rs("username")=Username
rs("password")=Password
rs("firstname")=Firstname
rs("lastname")=Lastname
rs("aem")=AEM
'rs("emailaddress")= EmailAddress
'Save record
rs.Update
set rs=nothing
set conn=nothing
Response.Redirect("login.asp?login=creatednew")
%>
I have created two tables in a database, the first one called "userlist" and the second "students" . I want to be able to register only users whose AEM (personal number of students) from the student table is the same with the AEM who write when they do create of a new login.
if anyone can help me , please sent all the new code for the register page.
thank you