<% M_UAdd = fun_chkRight("Staff","D") M_LAdd = fun_chkRight("Login","D") if M_UAdd = 0 and M_LAdd = 0 then %> <% response.end end if%> <% Function fixquotes(theString) fixquotes = Replace(theString,"'","''") End Function EMsg = "" userId = fixquotes(Trim(request.form("userId"))) loginId = fixquotes(Trim(request.form("loginId"))) if userId = "" or isNumeric(userId) = False Then Response.Redirect "userL.asp" userFnm = fixquotes(Trim(request.form("userFnm"))) userLnm = fixquotes(Trim(request.form("userLnm"))) notes = fixquotes(Trim(request.form("notes"))) display = fixquotes(Trim(request.form("display"))) active = "" if display = "N" Then active = "N" if userFnm = "" Then EMsg = "   * *   Enter First Name
" if userLnm = "" Then EMsg = EMsg & "   * *   Enter Last Name
" login = fixquotes(Trim(request.form("login"))) pasword = fixquotes(Trim(request.form("pasword"))) if active = "" Then active = fixquotes(Trim(request.form("active"))) end if userType = fixquotes(Trim(request.form("userType"))) linkNm = "" rights = "" if login <> "" Then if pasword = "" Then EMsg = EMsg & "   * *   Enter Password
" if active = "" then EMsg = EMsg & "   * *   Check whether login is active or not.
" if len(login) > 10 Then EMsg = EMsg & "   * *   Login can be of maximum 10 character
" if len(pasword) > 12 Then EMsg = EMsg & "   * *   Password can be of maximum 12 character
" ttlLinks = fixquotes(Trim(request.form("ttlLinks"))) if ttlLinks = "" Then EMsg = EMsg & "   * *   First Define Rights and then enter user" for l=0 To ttlLinks tmplinkNm = "" tmprights = "" tmplinkNm = fixquotes(Trim(request.form(("linkNm")&l))) tmprights = fixquotes(Trim(request.form(("rights")&l))) if tmprights <> "" Then if linkNm <> "" Then linkNm = linkNm & "," & tmplinkNm else linkNm = tmplinkNm end if if rights <> "" Then rights = rights & "|" & tmprights else rights = tmprights end if end if linkNm = replace(linkNm,", ",",") rights = replace(rights,", ",",") next if rights = "" Then EMsg = EMsg & "   * *   Select at least one user right" 'Response.Write linkNm & " -- " & rights 'Response.End end if if Trim(EMsg) = "" Then logdate = date() & " " & time() tableNm = "users" colNm = "userId" set rs = Server.CreateObject("ADODB.Recordset") if EMsg = "" Then strSQL = "select userId from users where userFnm='" & userFnm & "' and userLnm = '" & userLnm & "' and userId <> " & userId rs.Open strSQL, con, 3, 3 if not rs.EOF Then EMsg = "User already exists" end if rs.Close if loginId = "" and login <> "" Then strSQL = "select loginId from admin where login = '" & login & "'" rs.Open strSQL, con, 3, 3 if not rs.EOF Then EMsg = "Login already exists" end if rs.Close end if end if if EMsg = "" Then con.BeginTrans strSQL = "update users set userFnm = '" & userFnm & "', userLnm = '" & userLnm & "', notes = '" & notes & "', updated = '" & logdate & "', display = '" & display & "' where userId = " & userId 'response.write strSQL con.Execute(strSQL) activity = "User Edited - " & login ActivityLog Session("loginId"), Session("userId"), "User", "A", "users", "userId", userId, activity, logdate, logdate if login <> "" Then if loginId = "" Then strSQL="select top 1 loginId from admin order by loginId desc" rs.Open strSQL, con, 3, 3 if rs.EOF Then loginId = 1 else loginId = cint(rs("loginId")) + 1 end if rs.Close strSQL = "insert into admin (loginId, login, pasword, linkNm, rights, tableNm, colNm, recordId, userType, active, logdate, updated) values (" & loginId & ", '" & login & "', '" & pasword & "', '" & linkNm & "', '" & rights & "', '" & tableNm & "', '" & colNm & "', " & userId & ", '" & userType & "', '" & active & "', '" & logdate & "', '" & logdate & "')" 'response.write strSQL 'response.end con.Execute(strSQL) activity = "Login Added - " & login ActivityLog Session("loginId"), Session("userId"), "Login", "A", "admin", "loginId", 0, activity, logdate, logdate else strSQL = "update admin set pasword = '" & Encpasword & "', linkNm = '" & linkNm & "', rights = '" & rights & "', userType = '" & userType & "', updated = '" & logdate & "', active = '" & active & "' where loginId = " & loginId 'response.write strSQL 'response.end con.Execute(strSQL) activity = "Login Edited - " & login ActivityLog Session("loginId"), Session("userId"), "Login", "A", "admin", "loginId", loginId, activity, logdate, logdate end if end if con.CommitTrans end if end if set rs = nothing con.Close set con = nothing 'Response.end if Trim(EMsg) = "" Then Response.Redirect "userV.asp?id=" & Server.URLEncode(userId) else %>
Edit User
Your Form was not submitted.
Please check & provide following details
<%=Trim(EMsg)%>
<% end if %>