Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/10/2012, 01:54
KenMasters
 
Fecha de Ingreso: abril-2005
Ubicación: Piura - Perú
Mensajes: 189
Antigüedad: 19 años, 1 mes
Puntos: 0
problema consulta simple

tengo el siguiente código; de autentificacionde usuarios, y con nivel de jerarquiza.. pero me sale error de

Código PHP:
Parse errorsyntax errorunexpected T_VARIABLEexpecting '(' in E:allenwwwoctubre2012trabajo_yino1index.php on line 92 
lo unico que quiero es que logee y muestre que nivel es; y las paginas seguras segun el nivel, porque hay dos niveles profesores y alumnos,

el codigo del error lo adjunto

Código PHP:
<?
session_start
();
require_once(
'config1.php');
//cargar variables
$user $_POST["username"];
$pass $_POST["password"];



?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
  <title><? $website ?></title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta name="generator" content="handmade" />
    <style type="text/css">
    <!--
        body {
            font-family: Arial, Helvetica, sans-serif;
            font-size: 14px;
            background-color: #DDDDDD;
        }
        .cnt {
            text-align: center;
        }
        .cnt_welcome {
            font-size: 16px;
            font-weight: bold;
            text-align: center;
        }
        .cnt_powered {
            font-size: 14px;
            font-weight: bold;
            text-align: center;
        }
        .cnt_small {
            font-size: 12px;
            text-align: center;
            padding-top: 50px;
        }
        .head_line {
            background-color: #BBBBBB;
        }
        .main_table {
            border: solid 1px #9D9992;
            font-size: 13px;
        }
        h4 {
            font-size: 12px;
            color: #DD0000;
            text-align: center;
        }
        .button {
            border: 1px solid #55555;
            font-weight: bold;
        }

</style>

</head>
<body>

<table width="790" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td colspan="2"><img src="images/logo_elearning.jpg" alt="" width="300" height="82" /></td>
  </tr>
  <tr>
    <td width="250">
    Bienvenido <? echo $_SESSION['username'];  ?> <br />
    Nivel : <? echo $_SESSION['nivel']; ?>
    <br />
    <blockquote>
    - Inicio<br />
    - Mis cursos<br />
    - Inscripcion<br />
    - Salir <br />
    </blockquote><br />
    </blockquote>
    </td>
    <td width="540">
    <? if($_POST['submit']){
    
$checkuser mysql_query('SELECT * FROM usuarios WHERE username= "  $user " and password= "  $pass " ');
    
$username_exist mysql_num_rows($checkuser);
    
    if (
$username_exist>0// identificacion de usuarios existosa
        
$checknivel mysql_query('SELECT * FROM usuarios WHERE username="  $user  "');    
        
//$num = mysql_numrows ($checknivel); 
        //$row = mysql_fetch_row($checknivel)  
        //$row = mysql_fetch_assoc($checknivel);
        
while $row mysql_fetch_assoc($checknivel) {
        echo 
$row["1"];
        ]
        
session_register("username");
        
session_register("nivel");
        
        
$_SESSION['username'] = $user;
        
$_SESSION['nivel'] = $row['nivel'];
        
//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>";
    
} else {
    
?>

        <center>
        <h2>Bienvenido al sistema de educacion e-learning para el aprendizaje de corriente alterna</h2>
        <form name="form1" method="post" action="index.php">
        Username:<br>
        <input name="username" type="text" id="username">
        <br>
        Password: <br>
        <input name="password" type="password" id="password">
        <br>
        <br>
        <input name="submit" type="submit" id="submit" value="Login!">
        <br>
        <br>
        </form>
        </center>
    
    <? ?>
    </td>
  </tr>
  <tr>
    <td colspan="2"><center><font face="courier" size=1.5">Desing by KenMasters</font></center></td>
  </tr>
</table>

Mi version de Php es 5.2