Forums

This topic is locked

Allow users to change usernames

Posted 31 Aug 2001 09:04:34
1
has voted
31 Aug 2001 09:04:34 Bobby Jenkins posted:
Being a brand new newbie to UDzone, I don't know if my problem has been addressed.

After a user registers and logs in, he can go to a page to view his information. What I want to do is give the user the option to change his password AND his username at some later time. Of course, the new username will have to be checked against all others in the database and overwrite the old one. I think I can handle the changing of the passwords but I have no idea for the username. Can anybody help?

Thanks,
Bobby

Replies

Replied 31 Aug 2001 16:28:03
31 Aug 2001 16:28:03 Joel Martinez replied:
to change the password, I think you'll have to do a bit of custom coding...
first, make a recordset that searches for the new username... then put this code after it (of course customize it for yourself)<pre id=code><font face=courier size=2 id=code>&lt;%
if recordset1.eof then
'Put the update code here
SQL = <b>"UPDATE userTable SET username = '"& request("newUsername" &"' WHERE username like '"& request("oldusername" &"'"</b>
'finish the db connection code
else
response.write "Username already taken"
end if
%&gt;</font id=code></pre id=code>If you need some examples of what should be after the SQL statement I gave, just write again...
hope that helps,

Joel Martinez [ ]
----------
set rs = conn.execute("SELECT answer FROM brain WHERE question = "& forumPost &"
'2nd place is just 1st Loser
E-Commerce Concepts with Ultradev...pre-order yours at
www.basic-ultradev.com/ecomm_concepts/
Replied 31 Aug 2001 18:50:47
31 Aug 2001 18:50:47 Bobby Jenkins replied:
Hey Joel,

It looks like the code is what I'm looking for. However, looking at all the rest of the code that UD4 has already put on my page, I have no idea where to place the new code. If you could, please explain where the new code has to go.

Thanks,
Bobby

Replied 31 Aug 2001 20:04:40
31 Aug 2001 20:04:40 Joel Martinez replied:
well, I think that if you're going to be changing something like the username, you should make it go to a special page, Where you would let them put in the old username, and then the new one.

then just post the form to a processor page, this page would only perform the function of changing the username...
on the processor page, apply the recordset SB looking for the new username (to make sure it's not taken), then go into the code I described.

Joel Martinez [ ]
----------
set rs = conn.execute("SELECT answer FROM brain WHERE question = "& forumPost &"
'2nd place is just 1st Loser
E-Commerce Concepts with Ultradev...pre-order yours at
www.basic-ultradev.com/ecomm_concepts/

Reply to this topic