%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <%session("RELOAD")=true %>
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers="ADMIN,SYSOP"
MM_authFailedURL="login.asp"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
If (false Or CStr(Session("MM_UserAuthorization"))="") Or _
(InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
MM_grantAccess = true
End If
End If
If Not MM_grantAccess Then
MM_qsChar = "?"
If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
MM_referrer = Request.ServerVariables("URL")
if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
Response.Redirect(MM_authFailedURL)
End If
%>
<%
' *** 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_maq_STRING
MM_editTable = "USUARIOSCRM"
MM_editColumn = "IDCLIENTE"
MM_recordId = "" + Request.Form("MM_recordId") + ""
MM_editRedirectUrl = "users.asp"
MM_fieldsStr = "INICIALES|value|ADMONRENTA|value|CARTCONTRA|value|NOMBRE|value|PASSWORD|value|ZONA|value|EMAIL|value|TIPOUSER|value|ACCENTER|value|DIVI|value|NIVAUTH|value|ZONA_TARIFA|value"
MM_columnsStr = "INICIALES|',none,''|ADMONRENTA|none,none,NULL|CARTCONTRA|none,none,NULL|NOMBRE|',none,''|PASSWD|',none,''|ZONA|',none,''|EMAIL|',none,''|TIPOUSER|',none,''|ACCENTER|none,none,NULL|DIVI|',none,''|NIVAUTH|none,none,NULL|ZONA_TARIFA|none,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
%>
<%
' *** 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 = "'" & strreplace(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 exist__idc
exist__idc = "1"
if (REQUEST("IDUSER") <> "") then exist__idc = REQUEST("IDUSER")
%>
<%
set acenter = Server.CreateObject("ADODB.Recordset")
acenter.ActiveConnection = MM_entradas_STRING
acenter.Source = "SELECT IDACCESS, DESCR FROM NIVEL_ACCESO"
acenter.CursorType = 0
acenter.CursorLocation = 2
acenter.LockType = 3
acenter.Open()
acenter_numRows = 0
%>
<%
set exist = Server.CreateObject("ADODB.Recordset")
exist.ActiveConnection = MM_maq_STRING
exist.Source = "SELECT * FROM USUARIOSCRM WHERE IDCLIENTE=" + strreplace(exist__idc, "'", "''") + " ORDER BY NOMBRE"
exist.CursorType = 0
exist.CursorLocation = 2
exist.LockType = 3
exist.Open()
exist_numRows = 0
if exist.eof then response.redirect("escribes.asp?cmd=" + "SELECT * FROM USUARIOS WHERE NOVEND='" + strreplace(exist__idc, "'", "''") + "'" )
%>
<%
set acenter = Server.CreateObject("ADODB.Recordset")
acenter.ActiveConnection = MM_entradas_STRING
acenter.Source = "SELECT IDACCESS, DESCR FROM NIVEL_ACCESO"
acenter.CursorType = 0
acenter.CursorLocation = 2
acenter.LockType = 3
acenter.Open()
acenter_numRows = 0
%>
<%
Dim DIVS
Dim DIVS_numRows
Set DIVS = Server.CreateObject("ADODB.Recordset")
DIVS.ActiveConnection = MM_maq_STRING
DIVS.Source = "SELECT * FROM DIVISIONES"
DIVS.CursorType = 0
DIVS.CursorLocation = 2
DIVS.LockType = 1
DIVS.Open()
DIVS_numRows = 0
%>
<%
Dim TARIFAS_ZONA
Dim TARIFAS_ZONA_numRows
Set TARIFAS_ZONA = Server.CreateObject("ADODB.Recordset")
TARIFAS_ZONA.ActiveConnection = MM_maq_STRING
TARIFAS_ZONA.Source = "SELECT ID_ZONA, NOMBRE FROM ZONAS_TARIFARIAS"
TARIFAS_ZONA.CursorType = 0
TARIFAS_ZONA.CursorLocation = 2
TARIFAS_ZONA.LockType = 1
TARIFAS_ZONA.Open()
TARIFAS_ZONA_numRows = 0
%>
<%
Dim zona
Dim zona_numRows
Set zona = Server.CreateObject("ADODB.Recordset")
zona.ActiveConnection = MM_maq_STRING
zona.Source = "SELECT ZONA FROM RESP_CREDITO"
zona.CursorType = 0
zona.CursorLocation = 2
zona.LockType = 1
zona.Open()
zona_numRows = 0
%>
<%
Dim nivs
Dim nivs_numRows
Set nivs = Server.CreateObject("ADODB.Recordset")
nivs.ActiveConnection = MM_maq_STRING
nivs.Source = "SELECT IDACCESS,DESCR,COMENTARIO,ACTIVO FROM NIVEL_ACCESO"
nivs.CursorType = 0
nivs.CursorLocation = 2
nivs.LockType = 1
nivs.Open()
nivs_numRows = 0
%>
<%
Dim news__nov
news__nov = "1"
if (request("IDCLIENTE") <> "") then news__nov = request("IDCLIENTE")
%>
<%if request("mod")=1 then modifica()%>
Información del Usuario
<%
exist.Close()
%>
<%
acenter.Close()
%>
<%
DIVS.Close()
Set DIVS = Nothing
%>
<%
TARIFAS_ZONA.Close()
Set TARIFAS_ZONA = Nothing
%>
<%
zona.Close()
Set zona = Nothing
%>
<%
nivs.Close()
Set nivs = Nothing
%>