| 编程中国 | 业界新闻 | 技术文章 | 视频教程 | 下载频道 | 程序源码 | 个人空间 | 编程论坛
全能ASP/PHP/ASP.NET主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付买域名,送MP3、MP4
高端软件开发 = 年薪十万不是梦赛孚耐:软件保护加密专家身份认证令牌USB KEY买空间,免费送域名(厦门中资源)
共有 220 人关注过本帖
标题:产生一个密码,并记录到数据库,然后发送给用户
收藏  订阅  推荐  打印 
hellode
Rank: 2
等级:注册会员
帖子:133
积分:1472
注册:2007-3-29
产生一个密码,并记录到数据库,然后发送给用户

--------------------------------------------------------------------------------


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="user@ursite.com'>mailid="user@ursite.com"
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
%>
搜索更多相关主题的帖子: 数据库  密码  用户  记录  
2008-8-20 10:48
awke002
Rank: 3Rank: 3
等级:中级会员
帖子:182
积分:2106
注册:2008-7-22

这个密码是终身制的么
还是只是第一次注册的时候,系统随机生成的密码。
用登陆了以后应该可以修改自己的密码了吧!
2008-8-20 10:57
关于我们 | 广告合作 | 编程中国 | 清除Cookies | Archiver | WAP | TOP

编程中国 版权所有,并保留所有权利。鲁ICP备08000592号
Powered by Discuz, Processed in 0.049300 second(s), 9 queries.
Copyright©2004-2008, BCCN.NET, All Rights Reserved