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

Sobre variables de sesion con Ultradev 4.0

Estas en el tema de Sobre variables de sesion con Ultradev 4.0 en el foro de ASP Clásico en Foros del Web. La declaracion de variables la hago asi: DISCULPEN POR COLOCAR EL CODIGO, NO SE SI VIOLA LAS NORMAS DEL FORO <%@LANGUAGE="VBSCRIPT"%> <!--#include file="Connections/autenticar.asp" --> <% ...
  #1 (permalink)  
Antiguo 20/12/2002, 10:20
zng
 
Fecha de Ingreso: diciembre-2002
Ubicación: Holguin
Mensajes: 109
Antigüedad: 22 años, 5 meses
Puntos: 0
Sobre variables de sesion con Ultradev 4.0

La declaracion de variables la hago asi:

DISCULPEN POR COLOCAR EL CODIGO, NO SE SI VIOLA LAS NORMAS DEL FORO

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/autenticar.asp" -->
<%
Se realiza la conexion a la BD y se crea un rs%>
<%
' *** 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("textfield"))
If MM_valUsername <> "" Then
MM_fldUserAuthorization=""
MM_redirectLoginSuccess="insert.asp"
MM_redirectLoginFailed="fail.asp"
MM_flag="ADODB.Recordset"
set MM_rsUser = Server.CreateObject(MM_flag)
MM_rsUser.ActiveConnection = MM_autenticar_STRING
MM_rsUser.Source = "SELECT Idperiodista, Passwd"
If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
MM_rsUser.Source = MM_rsUser.Source & " FROM dbo.Periodistas WHERE Idperiodista='" & MM_valUsername &"' AND Passwd='" & CStr(Request.Form("textfield2")) & "'"
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 false 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>Insertar</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="post" action="<%=MM_LoginAction%>">
<p>
<input type="text" name="textfield" value="">
</p>
<p>
<input type="text" name="textfield2">
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
</body>
</html>
<%
Recordset1.Close()
%>

-------------------------------------------------------------------

Pagina donde recibo la variable

------------------------------------------------------------------------

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/autenticar.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_autenticar_STRING
MM_editTable = "dbo.Noticias"
MM_editRedirectUrl = "insert.asp"
MM_fieldsStr = "Idperiodista|value|Titular|value|Resumen|value|De talle|value|Revisado|value|Fecha|value|Foto|value"
MM_columnsStr = "Idperiodista|none,none,NULL|Titular|',none,''|Res umen|',none,''|Detalle|',none,''|Revisado|none,1,0 |Fecha|',none,''|Foto|',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
%>
<%
set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_autenticar_STRING
Recordset1.Source = "SELECT * FROM dbo.Noticias"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 3
Recordset1.Open()
Recordset1_numRows = 0
%>
<html>
<head>
<title>recoger</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form method="post" action="<%=MM_editAction%>" name="form1">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">Idperiodista:</td>
<td>
<input type="text" name="Idperiodista" value="" size="32">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Titular:</td>
<td>
<input type="text" name="Titular" value="" size="32">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Resumen:</td>
<td>
<input type="text" name="Resumen" value="" size="32">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Detalle:</td>
<td>
<input type="text" name="Detalle" value="" size="32">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Revisado:</td>
<td>
<input type="checkbox" name="Revisado" value=1 >
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Fecha:</td>
<td>
<input type="text" name="Fecha" value="" size="32">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Foto:</td>
<td>
<input type="text" name="Foto" value="" size="32">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">&nbsp;</td>
<td>
<input type="submit" value="Insert Record">
</td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="true">
</form>
<p>&nbsp;</p>
</body>
</html>
<%
Recordset1.Close()
%>

La variable MM_valUsername es la que me interesa pasar al segundo Form y el valor de ella colocarlo en el TextField "Idperiodista"

Gracias
__________________
Zng
  #2 (permalink)  
Antiguo 20/12/2002, 11:30
 
Fecha de Ingreso: febrero-2002
Ubicación: Mi ASP Bunker
Mensajes: 397
Antigüedad: 23 años, 2 meses
Puntos: 1
<input type="text" name="Idperiodista" value="<%=Session("MM_Username")%>" size="32">
  #3 (permalink)  
Antiguo 21/12/2002, 09:22
zng
 
Fecha de Ingreso: diciembre-2002
Ubicación: Holguin
Mensajes: 109
Antigüedad: 22 años, 5 meses
Puntos: 0
no funciono

no se que pasa pero no funciono, lo q deseo es que con ese codigo pueda recoger el valor del primer textfield y pasaelo como parametro al primer textfield de la segunda pagina

zng
__________________
Zng
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 11:26.