SoloCodigo

Programación Web y Scripting => PHP => Mensaje iniciado por: neorent en Jueves 26 de Julio de 2007, 21:56

Título: Problemas De Session Con Php
Publicado por: neorent en Jueves 26 de Julio de 2007, 21:56
Estimados todos tengo el siguiente problema:

esto haciendo una validacion con php y no me resulta bien si les dejo el code me podrian ayudar?,

bueno aqui el index

Código: Text
  1.  
  2. <?
  3. session_start();
  4. $_SESSION["misesion"] = "";
  5. ?>
  6. <html>
  7. <head>
  8. </head>
  9. <body>  
  10. <form action="Validar.php" method="post" name="uservalida" id="uservalida">
  11. <div align="center">
  12. <table width="259" height="125" border="0" cellpadding="0" cellspacing="0" bgcolor="#A6C4E0">
  13. <tr bgcolor="#A6C4E0">
  14. <th width="112" height="19" align="center" bgcolor="#A6C4E0" >
  15. <div align="center" class="Estilo14">Autentificación </div></th>
  16. </tr>
  17. <tr bgcolor="#CFDDEB">
  18. <td valign="top" bordercolor="#330099" bgcolor="#CFDDEB" class="Estilo1"><p align="center"><span class="Estilo2 Estilo13 style23">Usuario:</span>
  19. <input name="usuario" type="text" size="15" maxlength="15" />
  20. </p>
  21. <p align="center"><span class="style23 Estilo2 Estilo13"><span class="Estilo13">Clave:</span>   </span>
  22. <input name="clave" type="password" id="clave" size="15" maxlength="15" />
  23. </p>
  24. <p align="center"><strong>
  25. <input name="submit" type="submit" value="Entrar" />
  26. </strong><a href="Cambiacluser.php" class="Estilo4">Cambiar clave</a> <strong class="Estilo4"><a href="Inscripciones.php" class="Estilo5">Registrarse</a></strong> </p></td>
  27. </tr>
  28. </table>
  29. </div>
  30. </form>
  31. </body>
  32. </html>
  33.  
  34.  

aqui donde valido y supuestamente deberia tomarse el valor

Código: Text
  1.  
  2. <title>Validacion...</title>
  3. <?php
  4. $usuario=$_POST['usuario'];
  5. $clave=$_POST['clave'];
  6. $conn = mysql_connect("localhost", "root", "");
  7. mysql_select_db("internet_db",$conn);
  8. $ssql = "SELECT * FROM usuarios WHERE nombre='$usuario' and passw='$clave'";
  9. $result = mysql_query($ssql,$conn);
  10. if (mysql_num_rows($result)!=0)
  11. {
  12.     $autentificado = "SI";
  13.   while($row = mysql_fetch_array($result))
  14.   {
  15.     $rut = $row['rut'];
  16.     if($rut==NULL)
  17.     {
  18.       echo "<script> top.location.href='inscripcion.php?user=$usuario&pass=$clave'</script>";
  19.     }
  20.     else
  21.     {
  22.       echo "<script> top.location.href='/portal/index.php'</script>";
  23.       session_start();
  24.       $_SESSION["misesion"] = $autentificado;
  25.     }
  26.   }
  27. }
  28. else
  29. {
  30.   $autentificado = "NO";
  31.   echo "<script> top.location.href='index.php'</script>";
  32. }
  33. mysql_free_result($rs);
  34. mysql_close($conn);
  35. ?>
  36.  
  37.  

y en este otro donde se supone debe validar si esta bien o no?

Código: Text
  1.  
  2. <?
  3. session_start();
  4. if (!isset($_SESSION['misesion']))
  5. {
  6. $miNuevaVariable  = $_SESSION['misesion'];
  7. }
  8. else
  9. {
  10. echo "<script> top.location.href='index.php'</script>";
  11. }
  12. ?>
  13. <?php
  14. header("Pragma: no-cache");
  15. define("CHEMIN", "");
  16. include("inc/includes.inc");
  17. $topmess = "";
  18. include("inc/hpage.inc");
  19.  
  20. if (!empty($editobox[0])) {
  21.   include(INCREP.$editobox[0].INCEXT);
  22. }
  23.  
  24. if (!empty($editobox[1])) {
  25.   include(INCREP.$editobox[1].INCEXT);
  26. }
  27.  
  28. if (!empty($editobox[2])) {
  29.   include(INCREP.$editobox[2].INCEXT);
  30. }
  31.  
  32. if (!empty($editobox[3])) {
  33.   include(INCREP.$editobox[3].INCEXT);
  34. }
  35.  
  36. include("inc/bpage.inc");
  37.  
  38. ?>
  39.  
  40.  

si tengo muchos errores me los podrian indicar?,

el tema es el siguiente, en el primer index envio los datos a validar y luego si esta ok los mando al otro index, el problema, es que no me carga la pagina, queda como si estuviera recargandose todo el tiempo, gracias por darse el tiempo de leer este codigo,
saludos a todos,
Neo.