Home | Advertising Info30 USERS CURRENTLY ONLINE   
PowerASP
   Site Search Contact Us Thursday, March 28, 2024  

  Active InfoActive Info  Display List of Info MembersMemberlist  Search The InfoSearch  HelpHelp
  RegisterRegister  LoginLogin
Classic ASP - Scripting
 PowerASP Code Help Area : Classic ASP - Scripting
Subject Info: login example - I need help A d d  -  P o s tAdd P o s t
Author
Message << Prev Info | Next Info >>
theano
Newbie
Newbie


Joined: July/22/2004
Location: Greece
Online Status: Offline
Info: 1
Added: July/22/2004 at 11:40am | IP Logged Quote theano

Hello , I have this code , is the register page for a login example:

<%

'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

Back to Top View theano's Profile Search for other info by theano
 
cwilliams
Admin Group
Admin Group
Avatar

Joined: April/26/2004
Location: United States
Online Status: Offline
Info: 137
Added: July/23/2004 at 12:07pm | IP Logged Quote cwilliams

I'd thingk about buying something like this if I were you. www.aspprotect.com "yes I sell it but it will save you a lot of time and you'll learn alot" You'd also need to custimize it a bit for your specific needs.

Back to your code...

Your doing some fairly bad things in the code above. Too many things to comment on really as I just dont have the time.

The looping thru records looking for the username being used is especially scary. That should a simple SQL statement with a specific query for that user. Looping thu records like that is a total waste of resources and could get real ugly if you had a lot of users..

Also, The errors you are sending back arent going to repopulate the fields people filled in and that make it a pain for anyone registering.

Take Care..



Edited by cwilliams on July/23/2004 at 12:11pm


__________________


Chris Williams
http://www.PowerASP.com
Back to Top View cwilliams's Profile Search for other info by cwilliams
 

If you wish to make a comment to this info you must first login
If you are not already registered you must first register

  A d d  -  P o s tAdd P o s t
Printable version Printable version

Info Jump
You cannot add new info in this area
You cannot add to info in this area
You cannot delete your info in this area
You cannot edit your info in this area
You cannot create polls in this area
You cannot vote in polls in this area

   Active Server Pages Rule The World
Contact Us  
All artwork, design & content contained in this site are Copyright © 1998 - 2024 PowerASP.com and Christopher J. Williams
Banner ads ,other site logos, etc are copyright of their respective companies.
STATS Unless otherwise noted - All Rights Reserved.

PowerASP active server pages asp.net microsoft .net framework sdk learn asp what is asp tutorial learn asp.net CJWSoft ASPProtect ASPBanner ASPClassifieds www.aspprotect.com, www.cjwsoft.com,www.aspclassifieds.com,www.aspphotogallery.com