Page 1 of 2

weird error

Posted: Wed Aug 04, 2004 1:04 am
by dwfait
Hi. I get this error in my code:

Parse error: parse error, unexpected $ in /home/stormst/public_html/SSPN/index.php on line 305


However, the weird thing is, that lines is:

</BODY></HTML>

whats even weirder is that even if i put a blank line at the end of the code, it still says its the last line of the code. Can anyone help with this problem?

Posted: Wed Aug 04, 2004 1:07 am
by kevin7
hmmm, if i am guessing right, did u check all the bracket is closed properly? this kind of error usually cause by it... {...

if not, u might need to paste ur code here... :P

Posted: Wed Aug 04, 2004 1:07 am
by markl999
The error is above that. Post a bit more, probably the last few lines of PHP code in that script.

Posted: Wed Aug 04, 2004 1:09 am
by dwfait
ok. here is lines 256 to 305 (the last line):

Code: Select all

} else if ($action=='cpcadf') {
if (is_null($suser)) {
echo "You are not logged in.";
} else {
$user = $_POST['user'];
$pass = $_POST['pass'];
$email = $_POST['email'];
$nname = $_POST['nname'];
if (is_null($user)) {
echo "You didnt enter a username.";
} else {
if (is_null($pass)) {
echo "You didnt enter a password.";
} else {

if (is_null($email)) {
echo "You didnt enter an email address.";
} else {

    $link = mysql_connect("localhost", "root", "")
        or die("Could not connect");


mysql_select_db("stormst_sspp")
        or exit("Could not select database");

$resultt=mysql_query("SELECT id,user,pass from sspp WHERE user='$user' AND pass='$pass'");
if (mysql_num_rows($result)==0) {
echo "Bad username / password.";
} else {
list($id) = mysql_fetch_row($result);
mysql_query("UPDATE sspp SET nname='$nname' AND email='$email' WHERE id='$id'");

    mysql_close($link);
}
}
}


}
}

?>


  <BR></P><CENTER>
  <p></p>
  </CENTER></TD><TD width="11">&nbsp;</TD></TR><TR><TD width="12">&nbsp;</TD><TD width="510">&nbsp;</TD><TD width="11">&nbsp;</TD></TR></TABLE></TD><TD colspan="2" background="rechts.bmp"></TD></TR><TR><TD colspan="7"><IMG width="747" src="unten1.bmp" height="28"></TD><TD colspan="2"><A href="#top">
  <IMG src="totop.bmp" border="0"></A></TD><TD><IMG width="27" src="unten2.bmp" height="28"></TD></TR><TR><TD colspan="10"><IMG width="800" src="unten3.bmp" height="35"></TD></TR><TR><TD><IMG width="30" src="spacer.bmp" height="1"></TD><TD><IMG width="4" src="spacer.bmp" height="1"></TD><TD><IMG width="155" src="spacer.bmp" height="1"></TD><TD><IMG width="49" src="spacer.bmp" height="1"></TD><TD><IMG width="344" src="spacer.bmp" height="1"></TD><TD><IMG width="50" src="spacer.bmp" height="1"></TD><TD><IMG width="115" src="spacer.bmp" height="1"></TD><TD><IMG width="24" src="spacer.bmp" height="1"></TD><TD><IMG width="2" src="spacer.bmp" height="1"></TD><TD><IMG width="27" src="spacer.bmp" height="1"></TD></TR></TABLE></CENTER>
</BODY></HTML>

Posted: Wed Aug 04, 2004 1:12 am
by markl999
looks like a missing ?>
}
<BR></P><CENTER>
should be:
}
?>
<BR></P><CENTER>
??

Posted: Wed Aug 04, 2004 1:14 am
by dwfait
what the...i allready had a ?> in there, im looking at it now..?

Posted: Wed Aug 04, 2004 1:15 am
by markl999
Hmm..well it's not in your post above :o

Posted: Wed Aug 04, 2004 1:18 am
by dwfait
looks like i have a bad php editor...

copied and pasted into notepad, the ?> is there, saved it, uploaded it, same error.

Code: Select all

} else if ($action=='cpcadf') {
if (is_null($suser)) {
echo "You are not logged in.";
} else {
$user = $_POST['user'];
$pass = $_POST['pass'];
$email = $_POST['email'];
$nname = $_POST['nname'];
if (is_null($user)) {
echo "You didnt enter a username.";
} else {
if (is_null($pass)) {
echo "You didnt enter a password.";
} else {

if (is_null($email)) {
echo "You didnt enter an email address.";
} else {

    $link = mysql_connect("localhost", "root", "")
        or die("Could not connect");


mysql_select_db("stormst_sspp")
        or exit("Could not select database");

$resultt=mysql_query("SELECT id,user,pass from sspp WHERE user='$user' AND pass='$pass'");
if (mysql_num_rows($result)==0) {
echo "Bad username / password.";
} else {
list($id) = mysql_fetch_row($result);
mysql_query("UPDATE sspp SET nname='$nname' AND email='$email' WHERE id='$id'");

    mysql_close($link);
}
}
}
}

}
}

?>
  <BR></P><CENTER>
  <p></p>
  </CENTER></TD><TD width="11">&nbsp;</TD></TR><TR><TD width="12">&nbsp;</TD><TD width="510">&nbsp;</TD><TD width="11">&nbsp;</TD></TR></TABLE></TD><TD 

colspan="2" background="rechts.bmp"></TD></TR><TR><TD colspan="7"><IMG width="747" src="unten1.bmp" height="28"></TD><TD colspan="2"><A href="#top">
  <IMG src="totop.bmp" border="0"></A></TD><TD><IMG width="27" src="unten2.bmp" height="28"></TD></TR><TR><TD colspan="10"><IMG width="800" src="unten3.bmp" 

height="35"></TD></TR><TR><TD><IMG width="30" src="spacer.bmp" height="1"></TD><TD><IMG width="4" src="spacer.bmp" height="1"></TD><TD><IMG width="155" 

src="spacer.bmp" height="1"></TD><TD><IMG width="49" src="spacer.bmp" height="1"></TD><TD><IMG width="344" src="spacer.bmp" height="1"></TD><TD><IMG 

width="50" src="spacer.bmp" height="1"></TD><TD><IMG width="115" src="spacer.bmp" height="1"></TD><TD><IMG width="24" src="spacer.bmp" 

height="1"></TD><TD><IMG width="2" src="spacer.bmp" height="1"></TD><TD><IMG width="27" src="spacer.bmp" height="1"></TD></TR></TABLE></CENTER>
</BODY></HTML>

Posted: Wed Aug 04, 2004 1:18 am
by markl999
The other most likely candidate is all those {}'s not matching up.
If you indent what you posted then you are missing at least one } off the end.

Posted: Wed Aug 04, 2004 1:19 am
by dwfait
nope...it doesnt appear there in the <php> box..yet its there in the code, and it was there when i posted it...weird..can you try posting the same code with the ?> there?

Posted: Wed Aug 04, 2004 1:22 am
by markl999
I can see the ?> tag ok if i edit your post to view what you actually posted, but even in there you are missing a } off the end, i see 5 closing }'s when i reckon the should be 6.
Here's it with indenting:

Code: Select all

} else if ($action=='cpcadf')
{
  if (is_null($suser))
  {
    echo "You are not logged in.";
  } else
  {
    $user = $_POST['user'];
    $pass = $_POST['pass'];
    $email = $_POST['email'];
    $nname = $_POST['nname'];
    if (is_null($user))
    {
      echo "You didnt enter a username.";
    } else
    {
      if (is_null($pass))
      {
        echo "You didnt enter a password.";
      } else
      {
        if (is_null($email))
        {
          echo "You didnt enter an email address.";
        } else
        {
          $link = mysql_connect("localhost", "root", "")
          or die("Could not connect");
          mysql_select_db("stormst_sspp")
          or exit("Could not select database");
          $resultt=mysql_query("SELECT id,user,pass from sspp WHERE user='$user' AND pass='$pass'");
          if (mysql_num_rows($result)==0)
          {
            echo "Bad username / password.";
          } else
          {
            list($id) = mysql_fetch_row($result);
            mysql_query("UPDATE sspp SET nname='$nname' AND email='$email' WHERE id='$id'");
            mysql_close($link);
          }
        }
      }
    }
  }

Posted: Wed Aug 04, 2004 1:25 am
by dwfait
thanks a lot. is the tag not showing up because of the missing }?

edit: cant be, i just edited to put the missing } in its still not showing up.

Posted: Wed Aug 04, 2004 1:26 am
by markl999
Nope, the closing ?> tag isn't appearing because the <?php is missing at the top ;)

Posted: Wed Aug 04, 2004 1:28 am
by dwfait
ah...well it is only the ending of the code.

but now i got a different error, only the bottom half of the site is showing up (?)..to see the script look at http://sspn.stormystudios.com

Posted: Wed Aug 04, 2004 1:30 am
by markl999
Now you've got logic problems.
Eg see http://www.stormystudios.com/SSPN/index ... ion=cpcadf

What is your code supposed to do if $_GET['action'] isn't set or isn't one of your handled options?