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

Si no, mandalo a pagina denegado

Estas en el tema de Si no, mandalo a pagina denegado en el foro de ASP Clásico en Foros del Web. Hice una pagina que solo valida un campo Por decir un formulario con metodo GET Verifica y dice, si es Su contraseña, ENTRA a esta ...
  #1 (permalink)  
Antiguo 17/06/2004, 16:17
Avatar de MartYn  
Fecha de Ingreso: junio-2004
Ubicación: MTY-Mexico
Mensajes: 49
Antigüedad: 20 años
Puntos: 0
Pregunta Si no, mandalo a pagina denegado

Hice una pagina que solo valida un campo

Por decir un formulario con metodo GET
Verifica y dice, si es Su contraseña, ENTRA a esta Pagina

Pero si no ?
Marca error de linea...

como se pone ? para que le diga Acceso denegado o X cosa ?

mi ejemplo es:

Cita:

<form name="form1" method="get" action="menunoticias.asp">
<table width="80%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="27%"><b><font face="Verdana, Arial, Helvetica, sans-serif">CONTRASE&Ntilde;A</font></b></td>
<td width="73%">
<input type="password" name="pass" size="10" maxlength="6">
<input type="submit" name="Submit" value="ENTRAR">
<i><font color="#FFFF00"><a href="javascript:;" onClick="MM_openBrWindow('usuariosnoticias.asp','A ccesoNoticias','scrollbars=yes,width=280,height=20 0')">LISTA
DE ACCESOS</a></font></i> </td>
</tr>
</table>
</form>
Como iria ?
  #2 (permalink)  
Antiguo 17/06/2004, 22:00
Avatar de LeCLUB  
Fecha de Ingreso: abril-2003
Ubicación: Barcelona (España)
Mensajes: 205
Antigüedad: 21 años, 1 mes
Puntos: 1
esto lo tendrás que hacer en el archivo ASP, y no en el formulario.

Para escribir lueog texto utiliza:

response.write ("el texto que quieras")
  #3 (permalink)  
Antiguo 17/06/2004, 22:02
Avatar de AlZuwaga
Colaborador
 
Fecha de Ingreso: febrero-2001
Ubicación: 34.517 S, 58.500 O
Mensajes: 14.550
Antigüedad: 23 años, 3 meses
Puntos: 535
tenés que poner el código de "menunoticias.asp" en vez del que nos mostraste. ahí no hay ni un código ASP
  #4 (permalink)  
Antiguo 18/06/2004, 07:36
Avatar de MartYn  
Fecha de Ingreso: junio-2004
Ubicación: MTY-Mexico
Mensajes: 49
Antigüedad: 20 años
Puntos: 0
Pregunta codigo completo

Tienen Razon, no dice nada de ASP
es el puro formulario

Perdon, mejor aqui lo pego completo

Cita:
accesosnews.asp

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/proyectos.asp" -->
<%
Dim Recordset1__var
Recordset1__var = "%"
if (Request.QueryString("pass") <> "") then Recordset1__var = Request.QueryString("pass")
%>
<%
set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_proyectos_STRING
Recordset1.Source = "SELECT * FROM noticias WHERE pass LIKE '" + Replace(Recordset1__var, "'", "''") + "'"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 3
Recordset1.Open()
Recordset1_numRows = 0
%>
<html>
<head>
<STYLE type=text/css>BODY {
SCROLLBAR-FACE-COLOR: #CAE4FF; SCROLLBAR-HIGHLIGHT-COLOR: #000000; SCROLLBAR-SHADOW-COLOR: #000000; SCROLLBAR-ARROW-COLOR: #000000; SCROLLBAR-BASE-COLOR: #ffffff; scrollbar-3d-light-color: #000000; scrollbar-dark-shadow-color: #FFFFFF
}
INPUT {
FONT-SIZE: 10px; COLOR: #004080; FONT-FAMILY: Verdana, Arial, Helvetica; BACKGROUND-COLOR: #ffffff
}
TEXTAREA {
FONT-SIZE: 10px; COLOR: #ffffff; FONT-FAMILY: Verdana, Arial, Helvetica; BACKGROUND-COLOR: #ffffff
}
A {
TEXT-DECORATION: none
}
A:hover {
COLOR: black; TEXT-DECORATION: none
}
</STYLE>
<title>Acceso Ventas</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000" background="dawn.jpg" bgproperties="fixed">
<h2 align="center"><font color="#0000FF"><b><font color="#FFFFFF">ACCESO UNICO
A NOTICIAS</font></b></font></h2>
<form name="form1" method="get" action="menunoticias.asp">
<table width="75%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="37%"><b><font face="Verdana, Arial, Helvetica, sans-serif">CONTRASE&Ntilde;A</font></b></td>
<td width="63%">
<input type="password" name="pass" size="10" maxlength="6">
<input type="submit" name="Submit" value="ENTRAR">
</td>
</tr>
</table>
</form>
</body>
</html>
<%
Recordset1.Close()
%>

Y manda a este...

Cita:

menunoticias.asp


<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/proyectos.asp" -->
<%
' *** 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 = ""
%>
<%
' *** Insert Record: set variables

If (CStr(Request("MM_insert")) <> "") Then

MM_editConnection = MM_proyectos_STRING
MM_editTable = "publica"
MM_editRedirectUrl = "noticiaaceptada.htm"
MM_fieldsStr = "noticias|value|login|value|nivel|value|fecha|valu e"
MM_columnsStr = "noticias|',none,''|login|',none,''|nivel|',none,' '|fecha|',none,''"

' 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
%>
<%
' *** Insert Record: construct a sql insert statement and execute it

If (CStr(Request("MM_insert")) <> "") Then

' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
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_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End if
MM_tableValues = MM_tableValues & MM_columns(i)
MM_dbValues = MM_dbValues & FormVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"

If (Not MM_abortEdit) Then
' execute the insert
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 proyectos__var
proyectos__var = "%"
if (Request.QueryString("pass") <> "") then proyectos__var = Request.QueryString("pass")
%>
<%
set proyectos = Server.CreateObject("ADODB.Recordset")
proyectos.ActiveConnection = MM_proyectos_STRING
proyectos.Source = "SELECT * FROM noticias WHERE noticias.pass LIKE '" + Replace(proyectos__var, "'", "''") + "'"
proyectos.CursorType = 0
proyectos.CursorLocation = 2
proyectos.LockType = 3
proyectos.Open()
proyectos_numRows = 0
%>
<html>
<head>
<STYLE type=text/css>BODY {
SCROLLBAR-FACE-COLOR: #CAE4FF; SCROLLBAR-HIGHLIGHT-COLOR: #000000; SCROLLBAR-SHADOW-COLOR: #000000; SCROLLBAR-ARROW-COLOR: #000000; SCROLLBAR-BASE-COLOR: #ffffff; scrollbar-3d-light-color: #000000; scrollbar-dark-shadow-color: #FFFFFF
}
INPUT {
FONT-SIZE: 10px; COLOR: #004080; FONT-FAMILY: Verdana, Arial, Helvetica; BACKGROUND-COLOR: #ffffff
}
TEXTAREA {
FONT-SIZE: 10px; COLOR: #000000; FONT-FAMILY: Verdana, Arial, Helvetica; BACKGROUND-COLOR: #ffffff
}
A {
TEXT-DECORATION: none
}
A:hover {
COLOR: black; TEXT-DECORATION: none
}
</STYLE>
<title>Pagina Ventas</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000" background="dawn.jpg" bgproperties="fixed">
<table width="100%" border="0">
<tr>
<td width="27%"><img src="logo.jpg" border="0"></td>
<td width="73%">
<div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF"><b>Menu
Principal de <%=(proyectos.Fields.Item("descricpion").Value)% ></b></font></div>
</td>
</tr>
</table>
<h3 align="center"><font face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">Publicaciones
recientes acerca de la cadena</font></h3>
<form name="form1" method="POST" action="<%=MM_editAction%>">
<table width="100%" border="0">
<tr>
<td width="18%"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#CCCCCC">Publicciones:
</font></b><font face="Verdana, Arial, Helvetica, sans-serif" color="#CCCCCC">
: </font></td>
<td width="55%">
<textarea name="noticias" cols="60" rows="7"></textarea>
</td>
<td width="27%">&nbsp; </td>
</tr>
<tr>
<td width="18%">&nbsp; </td>
<td width="55%">
<div align="left">
<input type="submit" name="Submit" value="Enviar">
<input type="hidden" name="login" value="<%=(proyectos.Fields.Item("login").Value)%> ">
<input type="hidden" name="nivel" value="<%=(proyectos.Fields.Item("nivel").Value)%> ">
<input type="hidden" name="fecha" value="<%=now()%>">
</div>
</td>
<td width="27%">&nbsp; </td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="true">
</form>
<form name="detallehistory" method="get" action="detallehistorynoticias.asp">
<input type="submit" name="historyproyect" value="HISTORIAL">
<input type="hidden" name="login" value="<%=(proyectos.Fields.Item("login").Value)%> ">
</form>
<p>&nbsp;</p>
</body>
</html>
<%
proyectos.Close()
%>


Lo puse asi de largo como lo tengo

pero ahi excluyen lo que no les sirva

Es que nunca me ha salido eso de login y password con nivel de autoridad.
Entonces los mando solo con un campo, lo valida, lo deja pasar a la pagna esa.

Pero si no ?
Error X linea,,, donde acomodo , el SI no, ACCESO DENEGADO ?

Gracias
MartYn

Última edición por MartYn; 18/06/2004 a las 07:38
  #5 (permalink)  
Antiguo 18/06/2004, 15:26
Avatar de MartYn  
Fecha de Ingreso: junio-2004
Ubicación: MTY-Mexico
Mensajes: 49
Antigüedad: 20 años
Puntos: 0
Pregunta Ayudenme

Please como le hago :(
  #6 (permalink)  
Antiguo 19/06/2004, 20:01
Avatar de MartYn  
Fecha de Ingreso: junio-2004
Ubicación: MTY-Mexico
Mensajes: 49
Antigüedad: 20 años
Puntos: 0
como seria una ejemplo
de ..... no existe en la base de datos intenta nuevamente....

que valide si lo que escribio, por decir una clave de usuario, o una contraseña...???
  #7 (permalink)  
Antiguo 20/06/2004, 05:29
Avatar de maestro  
Fecha de Ingreso: febrero-2002
Ubicación: España
Mensajes: 2.364
Antigüedad: 22 años, 4 meses
Puntos: 1
Dale un vistazo a esto:
http://aspfacil.com/articulos/cv_usuarios.asp

Es un tutorial sobre el registro de usuarios y posterior identificacion usando una base de datos y sesiones.
__________________
Jose Maria Fernandez
[email protected]
Http://www.expansionweb.net
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 23:24.