home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
207.233.110.77
/
207.233.110.77.tar
/
207.233.110.77
/
vbasic
/
ForgotPassword.asp
< prev
next >
Wrap
Text File
|
2003-09-18
|
3KB
|
91 lines
<%@ LANGUAGE="VBSCRIPT" %>
<% Option Explicit %>
<!-- METADATA
TYPE="TypeLib"
FILE="C:\Program Files\Common Files\System\ADO\msado21.tlb"
-->
<!--#include file="DatabaseConnect.asp"-->
<%
Dim objRS
Dim sSQL
Dim strEmail
Dim Mailer
strEmail = Trim(Request.Form("email"))
If strEmail = "" Then
%>
<FORM METHOD=POST NAME=FindPassword ACTION=ForgotPassword.asp>
<!--Textbox and Button for FindPassword option-->
Enter your Visual Basic Student Account Email Address below:<BR><BR>
Email: <INPUT TYPE=TEXT NAME="email" SIZE="40"><BR><BR>
<INPUT TYPE=SUBMIT VALUE="Email Me My Password">
<INPUT TYPE="Button" VALUE="Cancel" onClick="document.location='default.asp';">
</FORM>
<%
Else
If Not IsValidEmail(strEmail) Then
Response.Redirect "error.asp?error=findpassword"
End If
sSQL = "SELECT * From Students Where email = '" & strEmail & "'"
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open sSQL, objConn, adOpenDynamic, adLockOptimistic, adCmdText
'Make sure the student's account exists
If Not (objRS.EOF And objRS.BOF) Then
'Email their Password to the Student
Set Mailer = Server.CreateObject("SoftArtisans.SMTPMail")
Mailer.FromName = "Guy Campbell"
Mailer.FromAddress = "gcampbell@moorparkcollege.net"
Mailer.organization = "Visual Basic - Moorpark College"
Mailer.Subject = "Moorpark College -- Visual Basic Account Information"
Mailer.smtplog = "C:\mysmtplog.txt"
Mailer.live = True
Mailer.RemoteHost = "sunny.moorpark.cc.ca.us"
Mailer.Priority = 3
Mailer.addrecipient objRS("name"), objRS("email")
Mailer.bodytext = "Here is your Visual Basic Account Password. " & vbCRLF _
& vbCRLF _
& "Name: " & objRS("name") & vbCRLF _
& "Email: " & objRS("email") & vbCRLF _
& "Password: " & objRS("password") & vbCRLF & vbCRLF _
& "Important: All information is case sensitive." & vbCRLF & vbCRLF _
& "Note: If you did not explicitly request that your password" & vbCRLF _
& "be emailed to you, please let me know immediately by" & vbCRLF _
& "emailing me at the address below." & vbCRLF & vbCRLF _
& "Thank You, " & vbCRLF & vbCRLF & "Guy Campbell" & vbCRLF & "gcampbell@moorparkcollege.net"
Mailer.SendMail
Mailer.ClearRecipients
Set Mailer = Nothing
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
Response.Write ("<B>An email has been sent to " & strEmail & "<BR>that includes your password information.</B><BR>")
%>
<BR><INPUT TYPE="Button" ALIGN="left" VALUE="Continue" onClick="document.location='default.asp';">
<%
Else
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
Response.Redirect "error.asp?error=noacct"
End If
End If
'Returns True if an email address is valid
Function IsValidEmail(strEmail)
Dim bIsValid
bIsValid = True
If Len(strEmail) < 5 Then
bIsValid = False
ElseIf Instr(1, strEmail, " ") <> 0 Then
bIsValid = False
ElseIf InStr(1, strEmail, "@", 1) < 2 Then
bIsValid = False
ElseIf InStrRev(strEmail, ".") < InStr(1, strEmail, "@", 1) + 2 Then
bIsValid = False
End If
IsValidEmail = bIsValid
End Function
%>