Ver Mensaje Individual
  #2 (permalink)  
Antiguo 09/01/2011, 04:41
Avatar de repara2
repara2
 
Fecha de Ingreso: septiembre-2010
Ubicación: München
Mensajes: 2.445
Antigüedad: 13 años, 7 meses
Puntos: 331
Respuesta: Ayuda a redireccionar

Sin entrar mucho en el código, tienes dos problemillas, faltan dos } y cierras la conexión antes de terminar el primer while:
Código PHP:
<?php
$con 
mysql_connect("server","user","password");
if (!
$con)
{
    die(
'Could not connect: ' mysql_error());
}

mysql_select_db("nombre_base"$con);


$result mysql_query("SELECT count(*) AS cuenta, password FROM usuario WHERE username='$_POST[usuario]'");

while(
$row mysql_fetch_array($result))
{
    
$crypted md5($_POST["clv"]);

    if (
$row['cuenta']==&& $row["password"] == $crypted ){

        
session_start("autentificado""usuario""nombre""apellido1");
        
$_SESSION["autentificado"]= "SI";
        
$_SESSION["usuario"] = $_POST["usuario"];

        
$result mysql_query("SELECT usr_id, username, nombre, apellido1, apellido2, tipo_perfil_id
FROM usuario
WHERE username='$_POST[usuario]';"
);

        
//echo "<table border='0' align='center'>";
        
while($row mysql_fetch_array($result))
        {
            
$_SESSION["nombre"] = $row["nombre"];
            
$_SESSION["apellido1"] = $row["apellido1"];
            
$redir ".index2.html?usr=" $row['usr_id'] . "&tp=" $row['tipo_perfil_id'];
            
header("Location: $redir");

            if (
$row['cuenta']==54 && $row["password"] == $crypted ){

                
session_start("autentificado""usuario""nombre""apellido1");
                
$_SESSION["autentificado"]= "SI";
                
$_SESSION["usuario"] = $_POST["usuario"];

                
$result mysql_query("SELECT usr_id, username, nombre, apellido1, apellido2, tipo_perfil_id
FROM usuario
WHERE username='$_POST[usuario]';"
);

                
//echo "<table border='0' align='center'>";
                
while($row mysql_fetch_array($result))
                {
                    
$_SESSION["nombre"] = $row["nombre"];
                    
$_SESSION["apellido1"] = $row["apellido1"];
                    
$redir2 ".index1.html?usr=" $row['usr_id'] . "&tp=" $row['tipo_perfil_id'];
                    
header("Location: $redir2");
                }
            } else {
                echo 
"<br><br><br><br><br><br><br><br><br><br><br>" ;
                echo 
"<table border='0' align='center'>
<tr>
<th><h1> Su usuario no ha sido aceptado*" 
$_POST[usuario] . "*</h1></th>
</tr>
<tr>
<th> <A href='aviso.html'> Intentar nuevamente </A>
</tr></table>"
;
            }
        }
        
    }
}
mysql_close($con);
?>
A ver si te sirve para empezar, saludos