Ver Mensaje Individual
  #4 (permalink)  
Antiguo 28/10/2012, 14:49
Avatar de ERICK59
ERICK59
 
Fecha de Ingreso: octubre-2012
Ubicación: Santo Domingo
Mensajes: 6
Antigüedad: 12 años, 3 meses
Puntos: 0
Respuesta: problema consulta simple

Como mensionaron antes tienes mucho errores de sierre aqui corregi el codigo prueba ahora
Código PHP:
Ver original
  1. <?
  2. require_once('config1.php');
  3. //cargar variables
  4. $user = $_POST["username"];
  5. $pass = $_POST["password"];
  6.  
  7.  
  8.  
  9. ?>
  10. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  11. <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
  12. <head>
  13.   <title><? $website ?></title>
  14.   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  15.   <meta name="generator" content="handmade" />
  16.     <style type="text/css">
  17.     <!--
  18.         body {
  19.             font-family: Arial, Helvetica, sans-serif;
  20.             font-size: 14px;
  21.             background-color: #DDDDDD;
  22.         }
  23.         .cnt {
  24.             text-align: center;
  25.         }
  26.         .cnt_welcome {
  27.             font-size: 16px;
  28.             font-weight: bold;
  29.             text-align: center;
  30.         }
  31.         .cnt_powered {
  32.             font-size: 14px;
  33.             font-weight: bold;
  34.             text-align: center;
  35.         }
  36.         .cnt_small {
  37.             font-size: 12px;
  38.             text-align: center;
  39.             padding-top: 50px;
  40.         }
  41.         .head_line {
  42.             background-color: #BBBBBB;
  43.         }
  44.         .main_table {
  45.             border: solid 1px #9D9992;
  46.             font-size: 13px;
  47.         }
  48.         h4 {
  49.             font-size: 12px;
  50.             color: #DD0000;
  51.             text-align: center;
  52.         }
  53.         .button {
  54.             border: 1px solid #55555;
  55.             font-weight: bold;
  56.         }
  57.  
  58. </style>
  59.  
  60. </head>
  61. <body>
  62.  
  63. <table width="790" border="0" cellspacing="0" cellpadding="0">
  64.   <tr>
  65.     <td colspan="2"><img src="images/logo_elearning.jpg" alt="" width="300" height="82" /></td>
  66.   </tr>
  67.   <tr>
  68.     <td width="250">
  69.     Bienvenido <? echo $_SESSION['username'];  ?> <br />
  70.     Nivel : <? echo $_SESSION['nivel']; ?>
  71.     <br />
  72.     <blockquote>
  73.     - Inicio<br />
  74.     - Mis cursos<br />
  75.     - Inscripcion<br />
  76.     - Salir <br />
  77.     </blockquote><br />
  78.     </blockquote>
  79.     </td>
  80.     <td width="540">
  81.     <? if($_POST['submit']){
  82.     $checkuser = mysql_query('SELECT * FROM usuarios WHERE username= "  $user " and password= "  $pass " ');
  83.    
  84.     $username_exist = mysql_num_rows($checkuser);
  85.    
  86.    
  87.     if ($username_exist>0){ // identificacion de usuarios existosa
  88.         $checknivel = mysql_query('SELECT * FROM usuarios WHERE username="  $user  "');    }
  89.         //$num = mysql_numrows ($checknivel);
  90.         //$row = mysql_fetch_row($checknivel)  
  91.         //$row = mysql_fetch_assoc($checknivel);
  92.         while ($row = mysql_fetch_assoc($checknivel)){
  93.         echo $row["1"];
  94.         }
  95.         session_register("username");
  96.         session_register("nivel");
  97.        
  98.         $_SESSION['username'] = $user;
  99.         $_SESSION['nivel'] = $row['nivel'];
  100.         //echo "<font color=\"#FF0000\"><b>Thank you for login in, you will be redirected to the protected pages in 2 seconds <META HTTP-EQUIV=\"refresh\" CONTENT=\"2; URL=index.php\"></b></font>";
  101.     } else {
  102.     ?>
  103.  
  104.         <center>
  105.         <h2>Bienvenido al sistema de educacion e-learning para el aprendizaje de corriente alterna</h2>
  106.         <form name="form1" method="post" action="index.php">
  107.         Username:<br>
  108.         <input name="username" type="text" id="username">
  109.         <br>
  110.         Password: <br>
  111.         <input name="password" type="password" id="password">
  112.         <br>
  113.         <br>
  114.         <input name="submit" type="submit" id="submit" value="Login!">
  115.         <br>
  116.         <br>
  117.         </form>
  118.         </center>
  119.    
  120.     <?php } ?>
  121.     </td>
  122.   </tr>
  123.   <tr>
  124.     <td colspan="2"><center><font face="courier" size=1.5">Desing by KenMasters</font></center></td>
  125.   </tr>
  126. </table>
  127. </body>
  128. </html>

Última edición por ERICK59; 28/10/2012 a las 15:18