<%OPTION EXPLICIT ByPassAdminCheck = true %> <% dim email, pw, DisplayCmd sub DoCheck AutoPage_Init email = Trim(Request("email")) FocusField = "email" if Request("Post") = "Y" then if email = "" then Success = false Msg = "Please enter your email address." exit sub end if dim sql sql = "select * from Employee where vEmail = 'EMAIL'" sql = Replace(sql, "EMAIL", SqlSafe(email)) DbConnect set rs = cn.Execute(sql) if rs.eof then rs.close set rs = nothing Success = false Msg = "Invalid email address." exit sub else DisplayCmd = "Show" SendPassword rs if Success then Msg = "Your password has been sent to the email account specified." end if end if end if end sub sub SendPassword(rs) dim live live = true dim Body, Mailer, Fullname Fullname = rs("vFirstname") & " " & rs("vLastname") Body = GetTemplate("ForgotPassword.html") body = Replace(body, "VSERVERNAME", Request.ServerVariables("SERVERNAME")) body = Replace(body, "VFULLNAME", Fullname) body = Replace(body, "VPASSWORD", rs("vPassword").value) if live then set Mailer = CreateObject("SMTPsvg.Mailer") Mailer.AddRecipient Fullname, rs("vEmail") Mailer.FromName = conFromName Mailer.FromAddress = conFromAddress Mailer.RemoteHost = conRemoteHost Mailer.ReturnReceipt = false Mailer.ConfirmRead = false Mailer.ContentType = "text/html" Mailer.Subject = "Your password - as requested." Mailer.BodyText = body Mailer.Urgent = false Mailer.Timeout = 30 if Mailer.SendMail then Success = true else Success = false Msg = "Due to a technical error - the email could not be sent. Please try again later." end if set Mailer = nothing else dbg body end if end sub sub WriteMessage p AutoPage_WriteMessage "Your password has been mailed to the specified account." end sub sub WriteForm br %>

Enter your email address with which you have registered below, and we will send your password to that email account.

<% dim ThisField if Not Success then AutoPage_WriteErrorMessage msg P end if AutoPage_WriteSelfPostingForm AutoPage_FormTableOpen "100%" ThisField = "email" AutoPage_FormRowOpen AutoPage_WriteLabel "Your email address" AutoPage_FormRowSplit AutoPage_WriteTextFieldWithValue ThisField, 35, 50, "text", email AutoPage_FormRowClose AutoPage_FormRowOpen2 "Center" br %><% AutoPage_FormRowClose AutoPage_FormTableClose AutoPage_WriteHiddenValue "Post", "Y" w "" AutoPage_WriteFocusField end sub Call Main sub Main DoCheck WriteHEader WriteEmloyeePageTitle "Forgot Password" If DisplayCmd = "Show" then WriteMessage else WriteForm end if %>

<% WriteFooter end sub %>