Foros del Web » Programando para Internet » ASP Clásico »

Problemas con restricción de página y forms

Estas en el tema de Problemas con restricción de página y forms en el foro de ASP Clásico en Foros del Web. Saludos antes que todo, mi problema es el siguiente estoy intentando restringir unas páginas donde agrego información que solo el administrador puede introducir el código ...
  #1 (permalink)  
Antiguo 28/01/2006, 11:04
Avatar de asm_mripZ  
Fecha de Ingreso: febrero-2002
Ubicación: Panamá
Mensajes: 212
Antigüedad: 22 años, 3 meses
Puntos: 0
Pregunta Problemas con restricción de página y forms

Saludos antes que todo, mi problema es el siguiente estoy intentando restringir unas páginas donde agrego información que solo el administrador puede introducir el código es el siguiente:

Página de Login:
Código:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../Connections/connDUgalleryAdmin.asp" -->
<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Request.QueryString
MM_valUsername=CStr(Request.Form("id"))
If MM_valUsername <> "" Then
  MM_fldUserAuthorization=""
  MM_redirectLoginSuccess="main.asp"
  MM_redirectLoginFailed="default.asp"
  MM_flag="ADODB.Recordset"
  set MM_rsUser = Server.CreateObject(MM_flag)
  MM_rsUser.ActiveConnection = MM_connDUgalleryAdmin_STRING
  MM_rsUser.Source = "SELECT U_ID, U_PASSWORD"
  If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
  MM_rsUser.Source = MM_rsUser.Source & " FROM USERS WHERE U_ID='" & Replace(MM_valUsername,"'","''") &"' AND U_PASSWORD='" & Replace(Request.Form("password"),"'","''") & "'"
  MM_rsUser.CursorType = 0
  MM_rsUser.CursorLocation = 2
  MM_rsUser.LockType = 3
  MM_rsUser.Open
  If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then 
    ' username and password match - this is a valid user
    Session("MM_Username") = MM_valUsername
    If (MM_fldUserAuthorization <> "") Then
      Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
    Else
      Session("MM_UserAuthorization") = ""
    End If
    if CStr(Request.QueryString("accessdenied")) <> "" And true Then
      MM_redirectLoginSuccess = Request.QueryString("accessdenied")
    End If
    MM_rsUser.Close
    Response.Redirect(MM_redirectLoginSuccess)
  End If
  MM_rsUser.Close
  Response.Redirect(MM_redirectLoginFailed)
End If
%>
<html>
<head>
<title>untitle</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="assets/DUgallery.css" rel="stylesheet" type="text/css">
<link href="../assets/DUgallery.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body,td,th {
 color: #000000;
}
body {
 background-color: #FFFFFF;
}
-->
</style></head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bg>
<table width="70%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" valign="middle"><table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr> 
          <td height="2" align="left" valign="top" bgcolor="#333333"><img src="../assets/_spacer.gif" width="1" height="1"></td>
        </tr>
        <tr> 
          <td align="center" valign="middle"><form name="form1" method="POST" action="<%=MM_LoginAction%>">
              <table border="0" cellpadding="4" cellspacing="4" bgcolor="#333333">
                <tr> 
                  <td width="151" align="right" valign="middle" class="textBold"><font color="#FFFFFF">Usuario</font></td>
                  <td width="269"><font color="#FFFFFF"> 
                    <input name="id" type="text" class="form" id="id" size="20">
                  </font></td>
                </tr>
                <tr> 
                  <td align="right" valign="middle" class="textBold"><font color="#FFFFFF">Contrase&ntilde;a</font></td>
                  <td><font color="#FFFFFF"> 
                    <input name="password" type="password" class="form" id="password" size="20">
                    </font></td>
                </tr>
                <tr> 
                  <td>&nbsp;</td>
                  <td> <input name="Submit" type="submit" class="form"  value="Login"></td>
                </tr>
              </table>
            </form></td>
        </tr>
        <tr> 
          <td height="2" align="left" valign="top" bgcolor="#333333"><img src="../assets/_spacer.gif" width="1" height="1"></td>
        </tr>
      </table></td>
  </tr>
</table>
</body>
</html>
Include del menú contiene este otro código que mantiene la restricción:
Código:
<%
' *** Logout the current user.
MM_Logout = CStr(Request.ServerVariables("URL")) & "?MM_Logoutnow=1"
If (CStr(Request("MM_Logoutnow")) = "1") Then
  Session.Contents.Remove("MM_Username")
  Session.Contents.Remove("MM_UserAuthorization")
  MM_logoutRedirectPage = "default.asp"
  ' redirect with URL parameters (remove the "MM_Logoutnow" query param).
  if (MM_logoutRedirectPage = "") Then MM_logoutRedirectPage = CStr(Request.ServerVariables("URL"))
  If (InStr(1, UC_redirectPage, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
    MM_newQS = "?"
    For Each Item In Request.QueryString
      If (Item <> "MM_Logoutnow") Then
        If (Len(MM_newQS) > 1) Then MM_newQS = MM_newQS & "&"
        MM_newQS = MM_newQS & Item & "=" & Server.URLencode(Request.QueryString(Item))
      End If
    Next
    if (Len(MM_newQS) > 1) Then MM_logoutRedirectPage = MM_logoutRedirectPage & MM_newQS
  End If
  Response.Redirect(MM_logoutRedirectPage)
End If
%>
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="default.asp"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
  If (true 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
%>
 <link href="../assets/DUgallery.css" rel="stylesheet" type="text/css"> 
 <div class = "links">
 <table width="120" border="0" cellspacing="0" cellpadding="0">
  <tr> 
      <td width="120" height="18" align="left" valign="middle" class="textBold">
   <a href="main.asp">INICIO</a>  <hr style="border:#D7D7D7 thin" />
   <a href="addmarca.asp">AGREGAR</a> <hr style="border:#D7D7D7 thin" />
   <a href="editmma.asp">EDITAR/BORRAR</a> <hr style="border:#D7D7D7 thin" />
   <a href="pictures.asp">IM&Aacute;GENES</a>  <hr style="border:#D7D7D7 thin" />
   <a href="approves.asp">APROBAR </a>  <hr style="border:#D7D7D7 thin" />
   <a href="password.asp">CONTRASE&Ntilde;A</a>  <hr style="border:#D7D7D7 thin" />
   <A HREF="<%=MM_Logout%>">SALIR</A></td>
    </tr>
</table>
</div>
Mi problema es que cuando tengo una página donde debo agregar info de un form en el que se hace upload de imágenes y luego de un tiempo como 15 min uno intenta hacer el insert y se queda como en loop hay algo que estoy haciendo mal aquí porque cuando acceso solo links después de ese tiempo me manda a la página de login que es lo que debería pasar antes de insertar. Si alguien puede darme luces se los agradecería mucho. Hasta pronto.
__________________
-- May the LinuxForce be with you --
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:48.