Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-05-2012, 02:57 PM   PM User | #1
Rayenz
New to the CF scene

 
Join Date: Mar 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rayenz is an unknown quantity at this point
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..
Rayenz is offline   Reply With Quote
Old 03-05-2012, 03:11 PM   PM User | #2
Keleth
Senior Coder

 
Join Date: Jun 2008
Location: New Jersey
Posts: 2,354
Thanks: 45
Thanked 247 Times in 244 Posts
Keleth is on a distinguished road
Which one is line 90?
Keleth is offline   Reply With Quote
Old 03-05-2012, 03:30 PM   PM User | #3
Rayenz
New to the CF scene

 
Join Date: Mar 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rayenz is an unknown quantity at this point
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 
            {
             
?>
Rayenz is offline   Reply With Quote
Old 03-05-2012, 04:19 PM   PM User | #4
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,505
Thanks: 45
Thanked 439 Times in 428 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
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?
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote
Old 03-05-2012, 04:29 PM   PM User | #5
Rayenz
New to the CF scene

 
Join Date: Mar 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rayenz is an unknown quantity at this point
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.
Rayenz is offline   Reply With Quote
Old 03-05-2012, 05:38 PM   PM User | #6
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,505
Thanks: 45
Thanked 439 Times in 428 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
In that case, you need to post more code not just part of it. PHP line numbers are not always correct.
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote
Old 03-05-2012, 06:33 PM   PM User | #7
Rayenz
New to the CF scene

 
Join Date: Mar 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rayenz is an unknown quantity at this point
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.
Rayenz is offline   Reply With Quote
Old 03-05-2012, 07:07 PM   PM User | #8
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,505
Thanks: 45
Thanked 439 Times in 428 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
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>
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote
Reply

Bookmarks

Tags
error, html, parse, php, unexpexted

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:50 AM.


Advertisement
Log in to turn off these ads.