Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Random password
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Random password

 Post Reply Post Reply
Author
288enzo View Drop Down
Groupie
Groupie
Avatar

Joined: 28 April 2003
Location: United States
Status: Offline
Points: 61
Post Options Post Options   Thanks (0) Thanks(0)   Quote 288enzo Quote  Post ReplyReply Direct Link To This Post Topic: Random password
    Posted: 06 May 2003 at 12:45am
First let me say that this forum is the best!

My latest question is that of how do I create random passwords and email them to individuals when they register on my site.

My form is basic:
<html>
<head>
<title>Registration</title>
</head>
<body>
<form method="POST" action="../in_work/post_user.asp">
<font face="BernhardMod BT" color="#000080">First Name
<input type="text" name="First" size="20" style="font-family: BernhardMod BT; font-size: 10pt; color: #0000FF" tabindex="1"><br>
Last Name
<input type="text" name="Last" size="30" style="font-family: BernhardMod BT; font-size: 10pt; color: #0000FF" tabindex="2"><br>
Email Address
<input type="text" name="Email" size="40" style="font-family: BernhardMod BT; font-size: 10pt; color: #0000FF" tabindex="3"><br>
<br>
User Name
<input type="text" name="user" size="20" style="font-family: BernhardMod BT; font-size: 10pt; color: #0000FF" tabindex="4"><br>
<br>
<input type="submit" value="Submit" name="Submit"><input type="reset" value="Reset" name="Reset"></form>
</font>
</body>
</html>

and the post_user.asp is basic as well:

<%
Dim adoCon                
Dim rsAddUser          
Dim strSQL               
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)};pwd=****; DBQ=" & Server.MapPath("../*******")
'adoCon.Open "DSN=**********"
Set rsAddUser = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT tblUsers.First, tblUsers.Last, tblUsers.Email, tblUsers.user FROM tblUsers;"
rsAddUser.CursorType = 2
rsAddUser.LockType = 3
rsAddUser.Open strSQL, adoCon
rsAddUser.AddNew
rsAddUser.Fields("First") = Request.Form("first")
rsAddUser.Fields("Last") = Request.Form("last")
rsAddUser.Fields("Email") = Request.Form("email")
rsAddUser.Fields("user") = Request.Form("user")
rsAddUser.Update
rsAddUser.Close
Set rsAddUser = Nothing
Set adoCon = Nothing
Response.Redirect "../index.htm"
%>

Can anyone tell me s..l..o..w..e..l..y.. what kind of changes I need to make to do what I asked above? I tried an autonumber in my database, but it tells me that I can only have one and it is for the user id. Then I tried just a random number and it comes up with a number about 10 characters long. I would like to randomize letters and numbers that total about 6 characters.

Thanks all that have helped in the past, and to those that will probably help me in the very near future.
Back to Top
ultramods View Drop Down
Groupie
Groupie
Avatar

Joined: 08 January 2003
Location: Scotland
Status: Offline
Points: 146
Post Options Post Options   Thanks (0) Thanks(0)   Quote ultramods Quote  Post ReplyReply Direct Link To This Post Posted: 06 May 2003 at 5:14am
Could I just ask first of all why would you want to allocate random passwords to users.
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 06 May 2003 at 8:20am
There are a bunch of examples on aspin.com for generating passwords. Just search for Random Password and it will give you plenty results.
Ultra, I think it can be useful if you want to email a new password to a users, more like a temp password. Based on the application it might be necessary. My company for example has a site in place where we only allow genereated passwords so no dictionary passwords can be used. It is a FDIC requirement in our case.
Back to Top
ultramods View Drop Down
Groupie
Groupie
Avatar

Joined: 08 January 2003
Location: Scotland
Status: Offline
Points: 146
Post Options Post Options   Thanks (0) Thanks(0)   Quote ultramods Quote  Post ReplyReply Direct Link To This Post Posted: 06 May 2003 at 8:43am

I think they have to be used carefully though. If the web site is compulsory for people to log onto for example in a work environment, then fair enough. However if its for a community site random passwords can be annoying more than anything, causing many users frustration.  Having said that if you want to use it then heres one method you can use to generate the password.

<%
dim random_Char, counter, password

' begin random function
randomize

' Begin a for next loop
For counter = 1 to 6

   'decide if char is going to be a number or letter 0=num 1 =letter
   random_numOrChar =  Int(2 * Rnd)

   IF random_numOrChar = 0 THEN

       random_Char = Int(9 * Rnd)
   ELSE

       ' select a number between 26 and 97
       random_Char = Int(26 * Rnd + 97)

       ' take the numeric and turn it into a character
       random_Char = Chr(random_Char)
   END IF

   ' Adds the most recent random letter to the letters string
   password = password & random_Char

' Repeat loop
next

' display the random password
response.write(password)
%>

Back to Top
288enzo View Drop Down
Groupie
Groupie
Avatar

Joined: 28 April 2003
Location: United States
Status: Offline
Points: 61
Post Options Post Options   Thanks (0) Thanks(0)   Quote 288enzo Quote  Post ReplyReply Direct Link To This Post Posted: 06 May 2003 at 9:19am

My thought behind using random generated passwords was so that each new user would have to enter a "VALID" email address in order to receive and email with their password.  If anyone has any better ideas I am more than happy to listen.

Also, how does one do multiple "not sure what word to put here"?  Example would be for someone to enter info that would be put into a database, emailed to them and emailed to me all from clicking one button.

Thanks for the tip Michael and to you UltraMods and big thanks  for the code example with explanations for each line - that is always a huge help.

Back to Top
ultramods View Drop Down
Groupie
Groupie
Avatar

Joined: 08 January 2003
Location: Scotland
Status: Offline
Points: 146
Post Options Post Options   Thanks (0) Thanks(0)   Quote ultramods Quote  Post ReplyReply Direct Link To This Post Posted: 06 May 2003 at 10:03am

To send the mail you could use one of bruce's tutotrials, as long as you have the required CDONTS/ jmail components installed on your server. To send the message to you and the user you could use either Carbon Copy or Blind Carbon Copy. Also You may want to adopt Bruce's account activation technique of sending an activtion link to the users email address. This way they must use a valid email address, but doesn't force them to use some random-easy to forget password. Everyones a winner.

http://www.webwiz.net/asp/tutorials/email_using_cdonts_tutorial.asp

http://www.webwiz.net/asp/tutorials/email_using_jmail_tutorial.asp

Back to Top
Bluefrog View Drop Down
Senior Member
Senior Member


Joined: 23 October 2002
Location: Korea, South
Status: Offline
Points: 1701
Post Options Post Options   Thanks (0) Thanks(0)   Quote Bluefrog Quote  Post ReplyReply Direct Link To This Post Posted: 08 May 2003 at 9:37am

The problem with dictionary passwords is easily solved by creating a random string (e.g. a session variable) server side and then using an MD5 algorithm on the client side to hash the password and random sting together. Of course this only applies to initially creating the password clientside and won't protect against keyloggers, but it will protect against network sniffers.

There are several MD5 algorithms available for free out there.

For sending "random" passwords, you can have a dictionary list of passwords, stick it in a dictionary object (memory expensive) and then generate a random number to choose one of them. That gives users a random password that they can remember easily.

Security is a complete farce anyways. There is no security on the internet. Servers can be mostly secured, but individual users are far too easy to hack to even bother with. The best stuff is all commercial and quite expensive.

Ultramods has the best answer up there - I'd go with his suggestions. Using random passwords offers no real security advantage against anyone who knows what they are doing.

 

 

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.