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

ASP
ASP编程菜鸟易犯的一个错误
ASP申请单动态添加实现方法及代码
经验总结:ASP与存储过程解析
学以致用 驳“ASP低能论”
使用ASP脚本技术
ASP、Request对象与SQL注入
判断访问是否来自搜索引擎的ASP函数
ASP判断数据库值是否为空的通用函数
大刀阔斧扔掉ASP,充分准备学习ASP.NET
关于创建多级文件夹的ASP函数实例
ASP正则判断取出HTML的图片地址的函数
网页不存在自动给管理员发邮件的ASP代码
ASP教程:等差数列和等比数列通项公式
Recordset对象和Command对象的区别
Filter与updatebatch混合使用实现批量更新
ASP实例:检测整数和长整数的函数
在不支持FSO的服务器上使用XMLDOM创建HTML文件
汉字转拼音ASP函数
网页输出N行N列表格的ASP实现方法
ASP操作数据库的类

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 77 ::
收藏到网摘: 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
%>