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

2016-01-29 17:31 2 1 收藏

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

【 tulaoshi.com - ASP 】

  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
%


The New Pass word has been Mailed.
 

来源:https://www.tulaoshi.com/n/20160129/1501718.html

延伸阅读
由于Access数据库记录集缓存的原因,从代码里得到Access数据库随机记录是得不到,需要用随机SQL语句的办法来消除缓存。 下面就是例子: 查看例子 %@ Page Language="C#" Debug="true" % %@ import Namespace="System.Data" % %@ import Namespace="System.Data.OleDb" % title随机得到Access数据库记录/title script runat="server" void Pa...
本文通过一个具体的实例来解决Oracle数据库如休在查询记录时给记录加锁呢? 系统环境 1、操作系统:Windows 2000 。 2、数据库: Oracle 8i R2 (8.1.6) for NT 企业版。 3、安装路径:C:\Oracle。 实现方法 利用SELECT的FOR UPDATE子句实现: conn system/manager--创建实验用户grant connect,resource to test identified by ...
刚安装完的MySQL中只有一个默认的用户,这就是root@localhost,如果需要使数据库被更多的用户访问使用,就需要添加新用户, 在windows可以用下面两种方法来添加: 使用GRANT语句: grant select on test.* to 'yonghu'@'%' identified by 'some_pass' with grant option; 例子表示增加一 个用户,...
标签: SQLServer
一、  自动应用重做日志 1、  利用SET  AUTORECOVERY命令自动应用重做日志 完成对数据文件的修复操作 SQLSTARTUP  MOUNT; 启动实例并加载数据库 SQLSET  AUTORECOVERY  ON 启用重做日志自动应用功能 SQLRECOVER  DATABASE 恢复指定表空间、数据文件或整个数据库 SQLALTER  DATABASE  OPEN; 完成...
魔漫相机发送给QQ好友方法   1)打开魔漫相机软件,进入魔漫相机后点击制作漫画。   2)制作好漫画后点击右测的小箭头,然后再点击QQ。   3)选择你要分享的QQ好友,选择好点击发送。那么你在魔漫相机中制作的漫画就已经发送给QQ好友了。           注 :更多精...

经验教程

694

收藏

64
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部