<%@LANGUAGE="VBSCRIPT"%> <% ' *** Edit Operations: declare variables MM_editAction = CStr(Request("URL")) If (Request.QueryString <> "") Then MM_editAction = MM_editAction & "?" & Request.QueryString End If ' boolean to abort record edit MM_abortEdit = false ' query string to execute MM_editQuery = "" %> <% ' *** Update Record: set variables If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then MM_editConnection = MM_p1clogin_STRING MM_editTable = "login" MM_editColumn = "username" MM_recordId = "'" + Request.Form("MM_recordId") + "'" MM_editRedirectUrl = "jump.asp" MM_fieldsStr = "password|value|currdate|value" MM_columnsStr = "password|',none,''|exdate|',none,NULL" ' create the MM_fields and MM_columns arrays MM_fields = Split(MM_fieldsStr, "|") MM_columns = Split(MM_columnsStr, "|") ' set the form values For i = LBound(MM_fields) To UBound(MM_fields) Step 2 MM_fields(i+1) = CStr(Request.Form(MM_fields(i))) Next ' append the query string to the redirect URL If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString Else MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString End If End If End If %> <% ' boolean for password check MM_badPassword = false ' password check lenMin = 8 lenSpec = 7 dim pwd, pwd2, strMessage pwd = Trim(CStr(Request.Form("password"))) pwd2 = Trim(CStr(Request.Form("password2"))) If pwd <> pwd2 Then strMessage = "Please type the password twice." MM_badPassword = true MM_abortEdit = true Else If len(pwd) < lenMin Then strMessage = "Password must be at least " & lenMin & " characters." MM_badPassword = true MM_abortEdit = true End If bolCharFound = false strSpecial = "`~!@#$%^&*()_-+={[}]|\<>?/" For i = 1 to lenSpec If inStr(1, strSpecial, Mid(pwd, i, 1), 1) <> 0 Then bolCharFound = true End If Next If not(bolCharFound) Then strMessage = "Password must have a special character (" & strSpecial & ") in the first " & lenSpec & " characters." MM_badPassword = true MM_abortEdit = true End If set objRS = Server.CreateObject("ADODB.Recordset") objRS.ActiveConnection = MM_p1clogin_STRING objRS.Source = "SELECT * FROM login WHERE username = '" + Session("Username") + "'" objRS.CursorType = 0 objRS.CursorLocation = 2 objRS.LockType = 3 objRS.Open() objRS_numRows = 0 If pwd = objRS.Fields.Item("password").Value Then strMessage = "Password must be different from previous password." MM_badPassword = true MM_abortEdit = true End If objRS.Close() End If ' *** Update Record: construct a sql update statement and execute it If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then ' create the sql update statement MM_editQuery = "update " & MM_editTable & " set " For i = LBound(MM_fields) To UBound(MM_fields) Step 2 FormVal = MM_fields(i+1) MM_typeArray = Split(MM_columns(i+1),",") Delim = MM_typeArray(0) If (Delim = "none") Then Delim = "" AltVal = MM_typeArray(1) If (AltVal = "none") Then AltVal = "" EmptyVal = MM_typeArray(2) If (EmptyVal = "none") Then EmptyVal = "" If (FormVal = "") Then FormVal = EmptyVal Else If (AltVal <> "") Then FormVal = AltVal ElseIf (Delim = "'") Then ' escape quotes FormVal = "'" & Replace(FormVal,"'","''") & "'" Else FormVal = Delim + FormVal + Delim End If End If If (i <> LBound(MM_fields)) Then MM_editQuery = MM_editQuery & "," End If MM_editQuery = MM_editQuery & MM_columns(i) & " = " & FormVal Next MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId If (Not MM_abortEdit) Then ' execute the update Set MM_editCmd = Server.CreateObject("ADODB.Command") MM_editCmd.ActiveConnection = MM_editConnection MM_editCmd.CommandText = MM_editQuery MM_editCmd.Execute MM_editCmd.ActiveConnection.Close If (MM_editRedirectUrl <> "") Then Response.Redirect(MM_editRedirectUrl) End If End If End If %> <% Dim objRS__MMColParam objRS__MMColParam = "1" If (Session("username") <> "") Then objRS__MMColParam = Session("username") End If %> <% set objRS = Server.CreateObject("ADODB.Recordset") objRS.ActiveConnection = MM_p1clogin_STRING objRS.Source = "SELECT * FROM login WHERE username = '" + Replace(objRS__MMColParam, "'", "''") + "'" objRS.CursorType = 0 objRS.CursorLocation = 2 objRS.LockType = 3 objRS.Open() objRS_numRows = 0 %> Change Password :: Pacific Office Solutions
Home E-store Contact Information
Latest News

Change User Password

<% if (objRS.Fields.Item("exdate").Value) < date() or Not(IsDate(objRS.Fields.Item("exdate").Value)) Then %>

Your password has expired: please change your password.

<% End If %> <% If MM_badPassword Then Response.Write("

" & strMessage & "

") %>
User Name <%=(objRS.Fields.Item("username").Value)%>
Full Name <%=(objRS.Fields.Item("fullname").Value)%>
Email <%=(objRS.Fields.Item("email").Value)%>
Password = date() Then Response.Write("value='" & (objRS.Fields.Item("password").Value) & "'") %>>
Reenter password = date() Then Response.Write("value='" & (objRS.Fields.Item("password").Value) & "'") %>>

">
<% objRS.Close() %>