当前位置: 首页 > 图文教程 > 网络编程 > ASP > 产生密码,记录到数据库,然后发送给用户。

ASP
开辟一条自由ASP快车道
用XML结合数据库,给服务器减负。
纯编码实现数据库的建立或压缩
多个表单和多个图片一起上传完美解决方案
列表项可上下移动的Multiple列表
模拟QQ的下拉列表选择图象
利用FSO取得BMP,JPG,PNG,GIF文件信息(大小,宽、高等)
二级域名原理以及程序,申请即可开通.
利用ASP+XML架设在线考试系统
ASP项目中的通用条件查询模块
一个为字符串中的网址加上链接的程序例子
用Agent+ASP技术制作语音聊天室
多表单域无组件文件上传的例子
使用xmlhttp为网站增加股市行情查询功能
用ASP开发WEB日期选择器
javascript+HTML仿造VB里的MonthView控件
使用xmlHttp结合ASP,实现网页的异步调用
调用DirectX的组件实现的时钟
在ASP页里面注册DLL的VBScript CLASS
ASP程序界面的多语言支持

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 55 ::
收藏到网摘: n/a

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

<%@language="vbscript" %>

******************************
<%
'code by Manikantan
'Web Developer
'3rd Agenda
'Nungambakkam, Chennai India
%>

<%

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
&href='mailto:mailid="[email protected]'>mailid="[email protected]"
address="address"


'other data like phone number as per the member database in the site
'all these values are obtained from the request method from a .htm which submits to this file
'Mainly employed in registration
'Assumes You have cdonts.dll installed in the web server.

set conn = server.CreateObject("adodb.connection")
conn.Open "dsn","uid","pwd"
set rec= conn.Execute("select count(*) from membertable")
id = cint(rec.fields(0))+1
r=rnd *50
Response.Write r & "<br>"
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

%>
<br>
<%
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
%>


The New Pass word has been Mailed.