| Author |
Topic Search Topic Options
|
gn00347026
Newbie
Joined: 17 February 2005
Location: United States
Status: Offline
Points: 8
|
Post Options
Thanks(0)
Quote Reply
Topic: username auto generate Posted: 25 October 2006 at 9:53am |
Hello all,
anyone know how to write a script that can make the username autocreate like
for the first user
use- a00001 //a0001 is generate by webwiz automatically.
the second user
will use - a00002 //a00002 is generate by webwiz automatically.,
thanks
|
 |
gn00347026
Newbie
Joined: 17 February 2005
Location: United States
Status: Offline
Points: 8
|
Post Options
Thanks(0)
Quote Reply
Posted: 02 November 2006 at 4:09am |
Hello All,
any one know ?
Urgent
when user wants to registrate a new account, the username is provided by the fourm ... user cannot define
|
 |
MadDog
Mod Builder Group
Joined: 01 January 2002
Status: Offline
Points: 3008
|
Post Options
Thanks(0)
Quote Reply
Posted: 02 November 2006 at 4:57am |
|
You need to recode parts of register.asp to do this task. It wouldnt be hard, but it would have to be something custom coded by yourself.
|
|
|
 |
gn00347026
Newbie
Joined: 17 February 2005
Location: United States
Status: Offline
Points: 8
|
Post Options
Thanks(0)
Quote Reply
Posted: 02 November 2006 at 7:15am |
 Thank you for your reply
Since i'm new to asp, any simular example?
|
 |
dpyers
Senior Member
Joined: 12 May 2003
Status: Offline
Points: 3937
|
Post Options
Thanks(0)
Quote Reply
Posted: 03 November 2006 at 3:38pm |
|
Set up an array containing all the characters/numbers you'd want to use. Then use the asp random command to generate a number between 0 and the length of the array -1
Use that number to add the character from the array to a string.
loop through the random - add character instructions x number of times to generate the id.
Set the username text box value to the generated id and disable the text box.
|
Lead me not into temptation... I know the short cut, follow me.
|
 |
gn00347026
Newbie
Joined: 17 February 2005
Location: United States
Status: Offline
Points: 8
|
Post Options
Thanks(0)
Quote Reply
Posted: 06 November 2006 at 3:43pm |
O.. i've tried .. but not success...
|
 |
gölge
Groupie
Joined: 16 April 2005
Location: Turkey
Status: Offline
Points: 182
|
Post Options
Thanks(0)
Quote Reply
Posted: 06 November 2006 at 5:12pm |
if i understand truely;
you can use ID for that
for example at register.asp you can change that code
'Read in the users details from the form If strMode = "new" Then strUsername = Trim(Mid(Request.Form("name"), 1, 15))
with that
'SQL to get the new Author_ID from the database strSQL = "SELECT " & strDBTop1 & " " & strDbTable & strDbTable & "Author.Author_ID " & _ "FROM " & strDbTable & "Author" & strDBNoLock & " " & _ "ORDER BY " & strDbTable & "Author.Author_ID DESC" & strDBLimit1 & ";"
'Query database rsCommon.Open strSQL, adoCon
If strMode = "new" Then strUsername = "a00000"& CLng(rsCommon("Author_ID"))
rsCommon.Close |
|
 |
dpyers
Senior Member
Joined: 12 May 2003
Status: Offline
Points: 3937
|
Post Options
Thanks(0)
Quote Reply
Posted: 06 November 2006 at 8:31pm |
Nice one! Simple, clean and elegant.
|
Lead me not into temptation... I know the short cut, follow me.
|
 |