Using ASP to change Database records

Results 1 to 4 of 4

Thread: Using ASP to change Database records

  1. #1
    Glenn Melton Guest

    Default Using ASP to change Database records

    Hi,<BR>I have a database containing usernames and passwords, and using 3 scripts to allow access to certain areas of a web site (a login page (login.asp), a verify page (verify.asp - that verifies the data entered in the form fields and the records in the database match), and an include that checks to make sure that the user as been authenticated before allowing them to view certain pages.<BR><BR>I need the ability to create an ASP page containing a form that will allow users to change thier usernames, and passwords.<BR><BR>If anyone can help me with this, I would appreciate it! :)<BR><BR>I kinda have an idea of how this "should" work, but Im not sure.<BR><BR>I "assume" that the form will have something like 5 fields, username, password (to verify against the database so they can only change thier data, and not someone elses), then a New username, and New password (that will write to the record in the database containing thier current username and password), and probibly a Password verify field that will make sure what they typed into the new password field is correct before allowing them to update the database (I also need help with that aspect, of making one field look at another field and verifying content before proceeding)<BR><BR>Thanks for any help in advance.

  2. #2
    Join Date
    Dec 1969

    Default RE: Using ASP to change Database records

    you answered your own question!! :)<BR><BR>you will have a login page that will verify the user has a corresponding username/pword in the database table to alter. after that has been verified/authenticated, you might want to create either a session variable or a hidden input type that contains the user&#039s id whom is logged in (pending your level of security).<BR><BR>On a second page you will verify the user&#039s existence (for security sake, via checking that the hidden field/session var is populated) and have text fields available to enter username/password (2 password boxes are usually the standard to confirm the passwords are identical). you may even want to pre-populate the username field with the current username before the update, display a confirmation message pending the database update and/or send an email after the password has been changed to the user reminding them of their uname/pword change, etc...all at your discretion.<BR><BR>After the user clicks on the submit button you can update the record with the information provided for the userid stored provided error checking has been done. Good luck! :)

  3. #3
    Jason Miller Guest

    Default RE: Using ASP to change Database records

    This assumes that IDs are unique.<BR><BR>Okay, we have user enter oldID and oldPW, as well as newID, newPW, confirmPW (5 fields, as you said).<BR><BR>1) if request.form("newPW") &#060;&#062; request.form("confirmPW") then send back that the new passwords don&#039t match. If either of them are blank/empty/len(trim()) = 0, send back that they need a password. If the newID is blank/empty/etc, also send this back.<BR><BR>2) if you can select an ID from your user table where ID = request.form("newID") and ("newID") &#060;&#062; ("oldID"), you&#039ll probably want to throw an error -- ID already in use.<BR><BR>3) update [table] set PW = &#039" & newPW & "&#039, ID = &#039" & newID & "&#039 where ID = &#039" & oldID & "&#039 and PW = &#039" & oldPW & "&#039<BR><BR>4) if you can select an id from your table where ID = newID and PW = newPW, you&#039re done. Otherwise, you&#039ll need some debugging.<BR><BR>Don&#039t forget syntax checkers so you don&#039t have users with rampant &#039s in their UID/PWs.<BR><BR>HiH

  4. #4
    Glenn Melton Guest

    Default RE: Using ASP to change Database records

    Thanks for the help guys! :)<BR><BR>I thought that might be what I needed to do, I was going about it a totally different way, and it wasn&#039t working. (we wont go into details about how I was trying to get around it.... heheheheh)<BR><BR>That was exactly what I needed! Thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts