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 = [email protected]
' 網管信箱.
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]