home *** CD-ROM | disk | FTP | other *** search
/ 207.233.110.77 / 207.233.110.77.tar / 207.233.110.77 / vbasic / ChangePassword.asp < prev    next >
Text File  |  2001-10-15  |  3KB  |  78 lines

  1. <%@ LANGUAGE="VBSCRIPT" %>
  2. <% Option Explicit %>
  3. <!-- METADATA 
  4.    TYPE="TypeLib" 
  5.    FILE="C:\Program Files\Common Files\System\ADO\msado21.tlb" 
  6. -->
  7. <!--#include file="DatabaseConnect.asp"-->
  8. <%
  9. Dim objRS
  10. Dim sSQL
  11. Dim strPassword
  12. Dim strEmail
  13. Dim strPath
  14. Dim Mailer
  15.  
  16. strPassword = Trim(Request.Form("password"))
  17. strEmail = Request.QueryString("email")
  18. strPath = Request.QueryString("path")
  19. If strPassword = "" Then
  20.     %>
  21.     <FORM METHOD=POST NAME=ChangePassword ACTION="ChangePassword.asp?email=<%=strEmail%>&path=<%=strPath%>">
  22.         <!--Textbox and Button for ChangePassword option-->
  23.         Enter a new Password below:<BR><BR>
  24.         New Password: <INPUT TYPE=TEXT NAME="password" SIZE="40"><BR><BR>
  25.           <INPUT TYPE=SUBMIT VALUE="Activate New Password">
  26.         <INPUT TYPE="Button" VALUE="Cancel" onClick="document.location='user.asp?action=list&email=<%=strEmail%>&path=<%=strPath%>';"> 
  27.     </FORM>
  28.     <%
  29. Else
  30.     sSQL = "SELECT * From Students Where email = '" & strEmail & "'"
  31.     Set objRS = Server.CreateObject("ADODB.Recordset")
  32.     objRS.Open sSQL, objConn, adOpenDynamic, adLockOptimistic, adCmdText
  33.     'Make sure the student's account exists
  34.     If Not (objRS.EOF And objRS.BOF) Then 
  35.         objRS("password") = strPassword
  36.         'Email the Student their new password information
  37.         Set Mailer = Server.CreateObject("SoftArtisans.SMTPMail")
  38.         Mailer.FromName = "Guy Campbell"
  39.         Mailer.FromAddress = "campbell_guy@hotmail.com"
  40.         Mailer.organization = "Visual Basic - Moorpark College"
  41.         Mailer.Subject = "Moorpark College -- Visual Basic Account Confirmation"
  42.         Mailer.smtplog = "C:\mysmtplog.txt"
  43.         Mailer.live = True
  44.         Mailer.RemoteHost = "sunny.moorpark.cc.ca.us"
  45.         Mailer.Priority = 3        
  46.         Mailer.addrecipient objRS("name"), objRS("email")
  47.         Mailer.bodytext = "Here is your New Visual Basic Account Password. " & vbCRLF _
  48.                 & vbCRLF _
  49.                 & "Name: " & objRS("name") & vbCRLF _
  50.                 & "Email: " & objRS("email") & vbCRLF _
  51.                 & "Password: " & objRS("password") & vbCRLF & vbCRLF _
  52.                 & "Important:  All information is case sensitive." & vbCRLF & vbCRLF _
  53.                 & "Note: If you did not explicitly change your password," & vbCRLF _                
  54.                 & "please let me know immediately by emailing me at the" & vbCRLF _
  55.                 & "address below." & vbCRLF  & vbCRLF _
  56.                 & "Thank You, " & vbCRLF & vbCRLF & "Guy Campbell" & vbCRLF & "campbell_guy@hotmail.com"
  57.         Mailer.SendMail                        
  58.         Mailer.ClearRecipients
  59.         Set Mailer = Nothing
  60.         objRS.Update
  61.         objRS.Close
  62.         Set objRS = Nothing
  63.         objConn.Close
  64.         Set objConn = Nothing
  65.         Response.Write ("<B>An email has been sent to " & strEmail & "<BR>that includes your New password information.</B><BR>")
  66.         %>
  67.         <BR><INPUT TYPE="Button" ALIGN="left" VALUE="Continue" onClick="document.location='user.asp?action=list&email=<%=strEmail%>&path=<%=strPath%>';"> 
  68.         <%
  69.     Else
  70.         objRS.Close
  71.         Set objRS = Nothing
  72.         objConn.Close
  73.         Set objConn = Nothing
  74.         Response.Redirect "error.asp?error=noacct"
  75.     End If
  76. End If
  77. %>
  78.