产生密码,记录到数据库,然后发送给用户。

This article Generates a password random, Requires a database and Mails the Password.

1@language="vbscript" 

1   
2'code by Manikantan   
3'Web Developer   
4'3rd Agenda   
5'Nungambakkam, Chennai India   
 1   
 2  
 3set mail= server.CreateObject("cdonts.newmail")   
 4mail.subject="Thank You for Registering"   
 5mail.to = mailid mail.from ="Webmaster@thesite"   
 6mail.body= "This is the Initial Password to our site...." & vbcrlf   
 7&href='mailto:mailid="[email protected]'>mailid="[email protected]"   
 8address="address"   
 9  
10  
11'other data like phone number as per the member database in the site   
12'all these values are obtained from the request method from a .htm which submits to this file   
13'Mainly employed in registration   
14'Assumes You have cdonts.dll installed in the web server.   
15  
16set conn = server.CreateObject("adodb.connection")   
17conn.Open "dsn","uid","pwd"   
18set rec= conn.Execute("select count(*) from membertable")   
19id = cint(rec.fields(0))+1   
20r=rnd *50   
21Response.Write r & "

``` " for i = 0 to 20 if cint(r)>0 and cint(r)<26 then str=str +chr(97 + cint(r)) r=rnd *100 next

Response.Write str
pwd=left(str,2)
pwd=pwd & id
pwd=pwd & right(str,2)
pwd=pwd & second(time)

'An Update Query can be Passed from here for the username ,password and other details or can be triggered
from another page 'when the user responds to the mail...Something like sending a url as a mail and on
click of the url in the mail..call another page 'which updates ..so we can be sure that only confirmed
users are updated


``` ```

set mail= server.CreateObject("cdonts.newmail")
mail.subject="Thank You for Registering"
mail.to = mailid
mail.from ="Webmaster@thesite"
mail.body= "This is the Initial Password to our site...." & vbcrlf & "Change it if You Want" & vbcrlf &
pwd & vbcrlf & "Thank You for Using the Site"
mail.send

1  
2  
3The New Pass word has been Mailed.
Published At
Categories with Web编程
Tagged with
comments powered by Disqus