Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Mar 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Parse error: syntax error, unexpected '}' in C:\wamp\www\cena\mudar_password_aluno.ph

    Parse error: syntax error, unexpected '}' in C:\wamp\www\cena\mudar_password_aluno.php on line 90


    PHP Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <?php session_start();
    /*if (empty($pag)){
      $pag=0;}
      else{ */
       
    $pag $_GET['pag'];//}

      
    $email $_SESSION['email_aluno'];

     if (
    $pag==0) {
        
    ?>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!-- TemplateBeginEditable name="doctitle" -->
    <title>Untitled Document</title>
    <!-- TemplateEndEditable -->
    <!-- TemplateBeginEditable name="head" -->
    <!-- TemplateEndEditable -->
    <link href="oneColFixCtrHdr.css" rel="stylesheet" type="text/css" />
    </head>

    <body>

    <div class="container">
      <div class="header">
        <div align="center"><img src="Logotipo Escola VRSA.jpg" alt="Insert Logo Here" name="Insert_logo" width="99" height="94" id="Insert_logo" style="background: #C6D580; display:block;" />  <a href="#">Rede Social da Escola Secundária de Vila Real de Santo António</a></div> 

        <!-- end .header --></div>
        <input onclick="history.back(-1)" type="button" value="Retroceder!" /><br>
        <table border='2'> <?php
           
    echo "<form action =\"mudar_password_aluno.php?pag=1\" method=\"POST\">"?>
                <tr>
                <td colspan='2' align='center'><h3>Mudar Password</h3></td>
                </tr>
                <tr>
                <td>Password antiga:</td>
                <td><input type='password' name='password_a'></td>
                </tr>
                <tr>
                <td>Nova password:</td>
                <td><input type='password' name='password_n'></td>
                </tr>
                <tr>
                <td>Repetir Nova Password:</td>
                <td><input type='password' name='repetir_password'></td>
                </tr>
                </table>
                <p><input type='submit' name='submit' value='Mudar a Password'></p>
          </form>

      <?
    }  
    else
    {
       
    $password_a $_POST['password_a'];
       
    $password_n $_POST['password_n'];
       
    $repetir_password $_POST['repetir_password'];
       
    $pass_velha_BD$_SESSION['password'];

        if (
    $password_a == $pass_velha_BD)
        {
           if (
    $repetir_password == $password_n)
            {
              if ((
    strlen($password_n)>=6) and (strlen($password_n)<=25))
                {
                  
    $connect mysql_connect ("localhost" "root" "") or die("Não pôde conectar!");
                  
    mysql_select_db ("rsesvrsa") or die ("Não pôde encontrar a base de dados");
                  
    $sql"UPDATE alunos SET password = md5('$password_n') WHERE email_aluno='$email'";
                  
    $resultado mysql_query($sql);
                   if (!
    $resultado)
                    {     
    ?>

                        <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
                        alert ("Não foi possível mudar a password")
                        </SCRIPT>

                        <?php
                    
    }
                    else 
                    {
                        
    ?>
                        <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
                        alert ("A password foi correctamente mudada")
                        </SCRIPT>
                        <?php
                        
    echo "<meta HTTP-EQUIV='refresh' CONTENT='0;URL=login_alu.php'>";
                    }
                     echo 
    "<a href='login.php'>Voltar</a>";
                 }
            }
    //<-- THIS IS THE LINE 90
                 
    else 
                {
                 
    ?>
                 <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
                 alert ("A password deverá conter entre 6 e 25 caracteres")
                 </SCRIPT>
                 <?php
                 
    echo "<meta HTTP-EQUIV='refresh' CONTENT='0;URL=mudar_password_aluno.php'>";
                }
            }
                else 
            {
             
    ?>

              <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
              alert ("A password repetida não coincide")
              </SCRIPT>

              <?php
              
    echo "<meta HTTP-EQUIV='refresh' CONTENT='0;URL=mudar_password_aluno.php'>";
            }
        }
          else 
        {
          
    ?>
           <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
           alert ("A password actual que foi introduzida não está cerrecta")
           </SCRIPT>

           <?php
           
    echo "<meta HTTP-EQUIV='refresh' CONTENT='0;URL=mudar_password_aluno.php'>";
        }
    }
    ?>


        <!-- end .content --></div>
      <div class="footer">
        <p>©2011 Hugo Mendonça</p>
        <!-- end .footer --></div>
      <!-- end .container --></div>
    </body>
    </html>
    It appears an error, please someone can give me a solution?
    Thank you

    Parse error: syntax error, unexpected '}' in C:\wamp\www\cena\mudar_password_aluno.php on line 90
    Last edited by Rayenz; 03-05-2012 at 03:46 PM.

  • #2
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,536
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Which one is line 90?

  • #3
    New to the CF scene
    Join Date
    Mar 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PHP Code:
                        <?php
                        
    echo "<meta HTTP-EQUIV='refresh' CONTENT='0;URL=login_alu.php'>";
                    }
                     echo 
    "<a href='login.php'>Voltar</a>";
                }
            }
    // <-- THIS ONE IS THE LINE 90.
                 
    else 
                {
                 
    ?>

  • #4
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,338
    Thanks
    60
    Thanked 527 Times in 514 Posts
    Blog Entries
    4
    So there is an unexpected } on line 90. You know where line 90 is and you're pointing to the } on line 90.

    Have you tried deleting it?
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #5
    New to the CF scene
    Join Date
    Mar 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by tangoforce View Post
    So there is an unexpected } on line 90. You know where line 90 is and you're pointing to the } on line 90.

    Have you tried deleting it?
    Yes, I've and is not the solution.

  • #6
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,338
    Thanks
    60
    Thanked 527 Times in 514 Posts
    Blog Entries
    4
    In that case, you need to post more code not just part of it. PHP line numbers are not always correct.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #7
    New to the CF scene
    Join Date
    Mar 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by tangoforce View Post
    In that case, you need to post more code not just part of it. PHP line numbers are not always correct.
    I've posted all the code above, just look there, thank you.

  • #8
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,338
    Thanks
    60
    Thanked 527 Times in 514 Posts
    Blog Entries
    4
    Done within 5 seconds in Notepad++ using the tip in the codingstyles link in my signature - you might find that a helpful read

    The extra } was actually on line 124. Presumably this was paired up with the commented out 'else' code under your session_start()?

    PHP Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <?php session_start();
    /*if (empty($pag)){
      $pag=0;}
      else{ */
       
    $pag $_GET['pag'];//}

      
    $email $_SESSION['email_aluno'];

     if (
    $pag==0) {
        
    ?>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!-- TemplateBeginEditable name="doctitle" -->
    <title>Untitled Document</title>
    <!-- TemplateEndEditable -->
    <!-- TemplateBeginEditable name="head" -->
    <!-- TemplateEndEditable -->
    <link href="oneColFixCtrHdr.css" rel="stylesheet" type="text/css" />
    </head>

    <body>

    <div class="container">
      <div class="header">
        <div align="center"><img src="Logotipo Escola VRSA.jpg" alt="Insert Logo Here" name="Insert_logo" width="99" height="94" id="Insert_logo" style="background: #C6D580; display:block;" />  <a href="#">Rede Social da Escola Secundária de Vila Real de Santo António</a></div> 

        <!-- end .header --></div>
        <input onclick="history.back(-1)" type="button" value="Retroceder!" /><br>
        <table border='2'> <?php
           
    echo "<form action =\"mudar_password_aluno.php?pag=1\" method=\"POST\">"?>
                <tr>
                <td colspan='2' align='center'><h3>Mudar Password</h3></td>
                </tr>
                <tr>
                <td>Password antiga:</td>
                <td><input type='password' name='password_a'></td>
                </tr>
                <tr>
                <td>Nova password:</td>
                <td><input type='password' name='password_n'></td>
                </tr>
                <tr>
                <td>Repetir Nova Password:</td>
                <td><input type='password' name='repetir_password'></td>
                </tr>
                </table>
                <p><input type='submit' name='submit' value='Mudar a Password'></p>
          </form>

      <?
    }  
    else
    {
       
    $password_a $_POST['password_a'];
       
    $password_n $_POST['password_n'];
       
    $repetir_password $_POST['repetir_password'];
       
    $pass_velha_BD$_SESSION['password'];

        if (
    $password_a == $pass_velha_BD)
        {
           if (
    $repetir_password == $password_n)
            {
              if ((
    strlen($password_n)>=6) and (strlen($password_n)<=25))
                {
                  
    $connect mysql_connect ("localhost" "root" "") or die("Não pôde conectar!");
                  
    mysql_select_db ("rsesvrsa") or die ("Não pôde encontrar a base de dados");
                  
    $sql"UPDATE alunos SET password = md5('$password_n') WHERE email_aluno='$email'";
                  
    $resultado mysql_query($sql);
                   if (!
    $resultado)
                    {     
    ?>

                        <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
                        alert ("Não foi possível mudar a password")
                        </SCRIPT>

                        <?php
                    
    }
                    else 
                    {
                        
    ?>
                        <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
                        alert ("A password foi correctamente mudada")
                        </SCRIPT>
                        <?php
                        
    echo "<meta HTTP-EQUIV='refresh' CONTENT='0;URL=login_alu.php'>";
                    }
                     echo 
    "<a href='login.php'>Voltar</a>";
                 }
            }
    //<-- THIS IS THE LINE 90
                 
    else 
                {
                 
    ?>
                 <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
                 alert ("A password deverá conter entre 6 e 25 caracteres")
                 </SCRIPT>
                 <?php
                 
    echo "<meta HTTP-EQUIV='refresh' CONTENT='0;URL=mudar_password_aluno.php'>";
                }
            }
                else 
            {
             
    ?>

              <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
              alert ("A password repetida não coincide")
              </SCRIPT>

              <?php
              
    echo "<meta HTTP-EQUIV='refresh' CONTENT='0;URL=mudar_password_aluno.php'>";
            }
        }
          else 
        {
          
    ?>
           <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
           alert ("A password actual que foi introduzida não está cerrecta")
           </SCRIPT>

           <?php
           
    echo "<meta HTTP-EQUIV='refresh' CONTENT='0;URL=mudar_password_aluno.php'>";
        }
    ?>


        <!-- end .content --></div>
      <div class="footer">
        <p>©2011 Hugo Mendonça</p>
        <!-- end .footer --></div>
      <!-- end .container --></div>
    </body>
    </html>
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •