0

So i was trying to get a login page that appears only to the members that are that level and them it says:

Parse error: syntax error, unexpected '13' (T_LNUMBER), expecting ')' in /home/limecd/public_html/admin/restrito.php on line 10

    <?
    ob_start();
    session_start();
    require_once("conecta.php");
    /////////////////////////////////////////
    echo "$level_usuario";
    $level = $level_usuario;
    //LEVELS THAT CAN ACCESS THE PAGE
    $lv = array(''13'',''100'',''10'',''25'',''14'');
    //SE NÃO TIVER VARIÁVEIS REGISTRADAS 
    //RETORNA PARA A TELA DE LOGIN 
    if( (!isset($_SESSION[id])) AND (!isset($_SESSION[name])) )
    { 
    Header("Location: index.html"); 
    };
    //level WITH GRANTED ACCESS
    if ($level_usuario == $lv[0] || $level_usuario == $lv[1] || $level_usuario == $lv[2] || $level_usuario == $lv[3] || $level_usuario == $lv[4] || $level_usuario == $lv[100] || $level_usuario == $lv[13])
    {
    echo "<center>";
    echo "Página secreta";
    echo "<br>";
    echo "<br><br><a href=''restrita2.php''>Restrita2</a>";
    echo "<br><br><a href=''restrita3.php''>Restrita3</a>";  
    echo "<br><br><a href=''logout.php''>Logout</a>";
    echo "</center>";
     }
    else
    {
    //DESTROY THE VARIABLES
    unset($_SESSION[id]); 
    unset($_SESSION[usuario]); 
    unset($_SESSION[nome]); 
    unset($_SESSION[level_usuario]);
    session_destroy(); 
    //REDIRECT FOR THE HOMEPAGE
    Header("Location: index.html"); 
  }
  ;
  ?>

This code would load a page called restrito.php and them it would show a menu that is restrict for the users!

1
  • Two single quotes '' is not the same thing as a double quote ". Commented Nov 19, 2013 at 17:06

2 Answers 2

3
$lv = array(''13'',''100'',''10'',''25'',''14'');

change to this

 $lv = array('13','100','10','25','14');
Sign up to request clarification or add additional context in comments.

Comments

1

You are using two single quotes. Either use single quotes like the following:

$lv = array('13','100','10','25','14');

or, double quotes like the following:

$lv = array("13","100","10","25","14");

or, since they are integers remove the quotes all together (unless you are trying to type cast) like:

$lv = array(13,100,10,25,14);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.