如何取回已忘记的密码?
forget.asp
' 申请.
<html>
<head>
<title>闪亮日子之用户密码核实</title>
</head>
<div align="center"><center>
<table border="0" cellspacing="0" width="600" height="158" >
<tr>
<td height="67"><p align="center">闪亮日子<br>
用户密码核实</td>
</tr>
<tr>
<td height="63"><p align="center"><font color="#0000FF">请正确填写您的邮件地址,我们会在核实后,尽快将密码寄给您!</font></p>
<form method="POST" action="sendit.asp">
<div align="center"><center><p>您的邮件地址: <input type="text" name="email"
size="20" style="font-size: 12pt"> <input type="submit" value="确定"
style="font-size: 12pt"> </p>
</center></div>
</form>
</td>
</tr>
</table>
</center></div>
</body></html>
sendit.asp
' 确认.
<%@ LANGUAGE="VBscript" %>
<% Option Explicit %>
<%
Dim DATA_PATH, objDC, objRS, email, user, pass, sendmail
DATA_PATH=Server.Mappath("users.mdb")
' 打开数据库.
Set objDC = Server.CreateObject("ADODB.Connection")
objDC.ConnectionTimeout = 15
objDC.CommandTimeout = 30
objDC.Open "DBQ=" & DATA_PATH & ";Driver={Microsoft Access Driver (*.mdb)}; DriverId=25;MaxBufferSize=8192;Threads=20;", "admin", "password"
Set objRS = Server.CreateObject("ADODB.Recordset")
email=request.form("email")
objRS.Open "select * from USERS WHERE email = '" & email & "'", objDC, 0, 1
' 校验用户的信箱是否存在.
%>
<html>
<head>
<title>山水盈盈之邮件地址错误提示</title>
</head>
<body>
<%
if objrs.EOF then
%>
<b><font color="red">
</font></b><div align="center"><center>
<table border="0" cellspacing="0" width="600" height="100" >
<tr>
<td height="64"><p align="center">山水盈盈<br>
邮件地址错误提示</font></td>
</tr>
<tr>
<td height="37"><b><font color="red"><p align="center">对不起,该用户邮件信箱:<%=email%>不存在!
</font></b></td>
</tr>
</table>
</center></div>
</body></html>
</font></B>
<% Else %>
<%
email = request.form("email")
' 从数据库中选取与递交的信箱对应的帐号,密码.
user = objrs.Fields("username")
pass = objrs.Fields("password")
Set sendmail = Server.CreateObject("CDONTS.NewMail")
sendmail.From = webmaster@intels.net
' 网管信箱.
sendmail.To = email
sendmail.Subject = "您的登录信息,请保存好!"
' 邮件主题.
sendmail.body = "您在山水盈盈的登录资料是:" & vbCrlf & vbCrlf _
& "Username=" & user & vbCrlf _
& "Password=" & pass & vbCrlf
' 邮件内容.
sendmail.Importance = 2
sendmail.Send
%>
您的资料已发送到<%=email%>,请收好,欢迎再次光临!<br>
<%
objDC.Close
Set objRS = Nothing
Set objDC = Nothing
Set sendmail = Nothing
%>
<%end if%>
[1]
下一篇:如何将产生的密码记录并发送给用户并通过点击链接激活?