Ver Mensaje Individual
  #3 (permalink)  
Antiguo 29/10/2009, 01:54
Avatar de angel_dope
angel_dope
 
Fecha de Ingreso: noviembre-2002
Ubicación: Valencia
Mensajes: 737
Antigüedad: 22 años, 2 meses
Puntos: 8
Respuesta: Ocultar parte del codigo segun un parametro

Mmm podría servir, aunque no estoy seguro, verás, dentro del código tengo una parte de asp .net con labels, buttons... pongo todo el código y sigo explicando

Código PHP:
    <body bgcolor="#004C64">
    <
br>
<
br>
<
table width="100%"  border="0" bgcolor="#FFFFFF">
  <
tr>
    <
td width="50%" align="center" bgcolor="#990000"><span class="Estilo15">Solicitud de informaci&oacute;</span></td>
    <
td width="50%" height="31" align="center" bgcolor="#990000"><span class="Estilo15">Acceso exclusivo para asociadosparticipantes en proyectos y usuarios registrados </span></td>
  </
tr>
  
  <
tr>
    <
td align="center" bgcolor="#E9E9E9"><form name="form" method="post" action="../gestion/s_informacion.asp">
      <
br>
      <
TABLE id="Table1" cellSpacing="1" cellPadding="1" width="247" border="0">
        
        <
TR>
          <
TD width="85" height="24" class="Estilo16">Empresa<span class="Estilo20">*</span>:</TD>
          <
TD width="155" height="24"><input name="empresa" type="text" id="empresa"></TD>
        </
TR>
        <
TR>
          <
TD class="Estilo16">CIF:</TD>
          <
TD><input name="cif" type="text" id="cif"></TD>
        </
TR>
        <
TR>
          <
TD class="Estilo16">Nombre<span class="Estilo20">*</span>:</TD>
          <
TD><input name="nombre" type="text" id="nombre"></TD>
        </
TR>
        <
TR>
          <
TD class="Estilo16">Apellidos<span class="Estilo20">*</span>:</TD>
          <
TD><input name="apellidos" type="text" id="apellidos"></TD>
        </
TR>
        <
TR>
          <
TD class="Estilo16">Tel&eacute;fono:</TD>
          <
TD><input name="telefono" type="text" id="telefono"></TD>
        </
TR>
        <
TR>
          <
TD class="Estilo16">E-mail<span class="Estilo20">*</span>:</TD>
          <
TD><input name="email" type="text" id="email"></TD>
        </
TR>
        <
TR>
          <
TD class="Estilo16">Consulta<span class="Estilo20">*</span>:</TD>
          <
TD><textarea name="consulta" cols="21" rows="6" id="consulta"></textarea></TD>
        </
TR>
        <
TR>
          <
TD class="Estilo12">&nbsp;</TD>
          <
TD>&nbsp;</TD>
        </
TR>
        <
TR>
          <
TD class="Estilo12">&nbsp;</TD>
          <
TD><label>
            <
input name="Submit2" type="button" class="Estilo20" onClick="validarCampos()" value="Enviar">
          </
label></TD>
        </
TR>
        
        <
TR>
          <
TD height="20" class="Estilo19">&nbsp;</TD>
          <
TD height="20" align="left" class="Estilo19">*Campos obligatorios </TD>
        </
TR>
      </
TABLE>
      </
form>    </td>
    <
td align="center" valign="top" bgcolor="#CDCDCD"><strong><font color="#434A50" face="Arial, Helvetica, sans-serif">
<
form id="Login" method="post" runat="server" >
  <
p>&nbsp;</p>
  <
p>&nbsp;</p>
'--------------------------------------------------------------------------------------------------------
  <TABLE id="Table1" cellSpacing="1" cellPadding="1" width="247" border="0">
                    <TR>
                        <TD width="85" height="37" class="Estilo12">
                          <div align="right">
                            <asp:Label ID="Label2" Runat="server">Usuario:</asp:Label>
                      </div></TD>
                        <TD width="155" height="37">
                            <asp:TextBox CssClass="Estilo12" ID="txtUsername" Runat="server"></asp:TextBox></TD>
                    </TR>
                    <TR>
                        <TD class="Estilo12">
                          <div align="right">
                            <asp:Label ID="Label3" Runat="server">Contraseña:</asp:Label>
                      </div></TD>
                        <TD>
                            <asp:TextBox CssClass="Estilo12" ID="txtPassword" Runat="server" TextMode="Password"></asp:TextBox></TD>
                    </TR>
                    <TR>
                        <TD class="Estilo12">                      </TD>
                        <TD>
                            <asp:TextBox CssClass="Estilo12" id="txtDomain" ReadOnly="True" Runat="server" Visible="false">AIDIMA</asp:TextBox></TD>
                    </TR>
                    <TR>
                      <TD class="Estilo12">&nbsp;</TD>
                      <TD align="left"><br>  
                        <div align="left">
                          <asp:Button CssClass="Estilo20" ID="btnLogin" Runat="server" Text="Aceptar" OnClick="Login_Click"></asp:Button> 
                          <input name="Submit" type="button" class="Estilo20" onClick="javascript:history.back(2)" value="Cancelar">
                      </div></TD>
            </TR>
                    <TR>
                      <TD colspan="2" class="Estilo12"><div align="justify"><strong><font color="#434A50" face="Arial, Helvetica, sans-serif">
                        <br>
                        </font></strong></div>                        <strong><font color="#434A50" face="Arial, Helvetica, sans-serif"><asp:Label ID="Label5" runat="server">
                          <div align="justify">Si ya es un usuario registrado introduzca sus datos. En caso contrario, vaya a la página de <a href="../gestion/registro.asp"><u>registro</u></a> para solicitar el mismo y será contactado en breve.</div>
                        </asp:Label>
                      </font></strong></TD>
            </TR>
          </TABLE>
            <br>
            <P><asp:Label ID="errorLabel" Runat="server" ForeColor="#ff3300"></asp:Label><br>
                <asp:CheckBox ID="chkPersist" Runat="server" Text="Persist Cookie" Visible="False" /></P>
      </form>
        <script runat="server">
sub Login_Click(sender as object,e as EventArgs)
  Dim adPath as String = "LDAP://DC=dominio,DC=es" '
Path to your LDAP directory server
  Dim adAuth 
as LdapAuthentication = new LdapAuthentication(adPath)
  try
      if(
true adAuth.IsAuthenticated(txtDomain.TexttxtUsername.TexttxtPassword.Text)) then
          Dim groups 
as string adAuth.GetGroups()
    
          
'Create the ticket, and add the groups.
          Dim isCookiePersistent as boolean = chkPersist.Checked
          Dim authTicket as FormsAuthenticationTicket = new FormsAuthenticationTicket(1, _
               txtUsername.Text,DateTime.Now, DateTime.Now.AddMinutes(60), isCookiePersistent, groups)
    
          '
Encrypt the ticket.
          
Dim encryptedTicket as String FormsAuthentication.Encrypt(authTicket)
    
          
'Create a cookie, and then add the encrypted ticket to the cookie as data.
          Dim authCookie as HttpCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket)
    
          if(isCookiePersistent = true) then
            authCookie.Expires = authTicket.Expiration
          end if
          '
Add the cookie to the outgoing cookies collection.
          
Response.Cookies.Add(authCookie)
          
session("usuario_aidima") = txtUsername.Text
          
'You can redirect now.
          Response.Redirect(FormsAuthentication.GetRedirectUrl(txtUsername.Text, false))

    else
      errorLabel.Text = "Authentication did not succeed. Check user name and password."
    end if

  catch ex as Exception
    '
errorLabel.Text "Error authenticating. " ex.Message
    dim usuario 
as string
    dim clave 
as string
    dim txt 
as string
    clave 
txtPassword.text
    usuario 
txtUsername.text
    txt 
"<html>"
    
txt txt "<body onLoad='document.novedades.submit()'>"
    
txt txt "<form name='novedades' action='../gestion/controlusuarios.asp' method='post'><br>"
    
txt txt "<input type='hidden' name='usuario' value='" usuario "'><br>"
    
txt txt "<input type='hidden' name='clave' value='" clave "'><br>"
    
txt txt "<input type='hidden' name='net' value='1'><br>"
    
txt txt "</form><br></body></html>"
    
Response.Write(txt)
     
end try
end sub
        </script>
    </font></strong></td>
  </tr>
 </table>
'--------------------------------------------------------------------------------------------------------
</body> 
La parte que está entre las dos lineas '-------------------------------------------------------------------------------------------------------- es la que debe salir siempre, independientemente del parámetro, y todo lo demás, si el parametro es diferente de 1 debe salir, y sino, pues no.
La verdad es que no tengo mucha idea de .net y para variar esto lo tengo que hacer de forma urgente. Me puedes indicar como tendria que ponerlo exactamente??
Muchas gracias, salu2
__________________
Vayamos por Partes :: Jack el Destripador