Ver Mensaje Individual
  #7 (permalink)  
Antiguo 18/11/2010, 04:33
Avatar de DiegoAH
DiegoAH
 
Fecha de Ingreso: noviembre-2010
Ubicación: Madrid
Mensajes: 53
Antigüedad: 13 años, 5 meses
Puntos: 0
Respuesta: session_star() con problemas

Vale e aqui mi decimoquinto problema....cuando click en boton de inisciar sesion no me redirije a la pagina desada: dejo el codigo, empiezo a estar un poco desesperado:

aqui es donde esta el boton (<br/><input type="submit" name="aceptar" id="aceptar" value="Continuar" onClick=" window.location.href='administrar.php' "/> <li>)


Código HTML:
Ver original
  1.     <head>
  2.     <title>LOGUEO</title>
  3.            
  4.    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  5.        <style type:="text/css">
  6.     body {
  7.     font-style:italic;
  8.     margin: 0 auto;
  9.     font-family: arial;
  10.     text-align:center;
  11.     background-color: #F0F0F0;
  12.     vertical-align:center;
  13.     background-image:url(fondo-cabecera.png);
  14.     background-repeat:repeat-x;
  15.         }
  16.        
  17.     #cabecera{
  18.     background-color:#000;
  19.     background-repeat:repeat;
  20.     margin-top:40px;
  21.     margin-bottom:60px
  22.    
  23.    
  24.             }
  25.    
  26.     #tabla1{
  27.     font-weight: bold;
  28.     color: #F0F0F0;
  29.     height:auto;
  30.     width:auto;
  31.     overflow: hidden;
  32.     class="fija";
  33.     font-family: Arial;
  34.     font-size: 20px;
  35.     font-style: normal;
  36.     line-height: normal;
  37.     text-transform: capitalize;
  38.     margin-top:120 px;
  39.  
  40.         }
  41.            
  42.     #general{
  43.             width:960px;
  44.             margin-top:60px;
  45.             margin-left:225px;
  46.                 }
  47.    
  48.          
  49.       p {
  50.          
  51.           font-family: Arial;
  52.           font-size: 12px;
  53.           font-weight:normal;
  54.          
  55.           }
  56.    
  57.      
  58.      
  59.     #barra{
  60.     background-repeat:repeat;
  61.     background-image: url(BARRA-INFERIOR.jpg);
  62.     margin-top:20px;
  63.      }
  64.      
  65.    
  66.     #link{
  67.         margin-top:345px;
  68.         font-family:arial;
  69.          font-size:14px;
  70.          font-weight:bold;
  71.         }
  72.  
  73.    
  74.         </style>
  75.        
  76.      
  77.        
  78. </head>
  79.    
  80.    
  81.  
  82.  
  83.  
  84. <div id="general">
  85.  
  86.   <div id="logoied" align="right"><img src="logo-izq.png" width="127" height="25" alt="buscar" align="left" />
  87.     <img src="logo-ied2.png" width="70" height="32" alt="buscar" />
  88.    
  89.   </div>
  90. <div id="tabla1">
  91.         <div id="" align="center">
  92.                     <p>introduce tus datos </p>
  93.  
  94.     </div>
  95.     <div id="centro">
  96.  
  97.    
  98.     <form name="form_logeo" id="form_logeo" method="post" action="login.php">
  99.     <table id="tabla1">
  100.        
  101.         <tr>
  102.             <td>Email:</td>
  103.             <td><input type="text" name="email" id="email" maxlength="80" size="15" /></td>
  104.         </tr>
  105.         <tr>
  106.             <td>Contrase&ntilde;a:</td>
  107.             <td>
  108.                 <input type="password" name="password" id="password" maxlength="15" size="15" />
  109.             </td>
  110.         </tr>
  111.  
  112.         <input type="hidden" name="aceptar" value="1" />
  113.                 <tr><td align="center" colspan="2"><br/><input type="submit" name="aceptar" id="aceptar" value="Continuar"  onClick=" window.location.href='administrar.php' "/>    <li><a href="administrar.php">Principal</a></li>
  114. </td></tr>     
  115.     </table>
  116.     </form>
  117.    
  118.    
  119. </div>
  120. <div id="link">
  121.  <a href="mostrar.php">Volver</a></div>
  122.     <div id="barra">
  123.    
  124.     <img src="BARRA-INFERIOR.jpg" width="1" height="2" alt="buscar" />
  125.     </div>
  126.  
  127.     <p align="right"><img src="logoizqabajo.png" width="95" height="15" alt="buscar" align="left"/><img src="logodrchabajo.png" width="61" height="28" alt="buscar" /></p>
  128.   <img src="derechos.png" width="191" height="9" alt="buscar" align="left" style="margin-top:-20px"/>
  129. </div>
  130. </div>
  131.  
  132.  
  133.  
  134. </body>
  135. </html>

Y esta es la accion que ocurrira al hacer click en el

Código PHP:
Ver original
  1. <?php
  2.     $usuario="root";
  3.     $password="";
  4.     $bd="admin";
  5.     mysql_connect('localhost',$usuario,$password);
  6.     mysql_select_db($bd) or die ("No podemos conectar con la Base de datos" );
  7.    
  8.     if(isset($_POST['aceptar'])){
  9.     $nombre=$_POST['email'];
  10.     $email=$_POST['password'];
  11.     $sql = mysql_query("SELECT email FROM administradores where ('$_POST[email]') and password=('$_POST[password]')");
  12.     $num_filas= mysql_num_rows($sql);
  13.     $fila=mysql_fetch_assoc($sql);
  14.         if ($num_filas!=0){
  15.             $_SESSION['login'] = "ok";
  16.             header ("Location: administrar.php");
  17.         }
  18.         else{
  19.             $error= "ERROR";           
  20.             header ("Location: resgirarse.php");
  21.            
  22.         }
  23.        
  24.     }
  25. ?>

Última edición por DiegoAH; 18/11/2010 a las 04:53