weird error
Moderator: General Moderators
weird error
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?
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?
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"> </TD></TR><TR><TD width="12"> </TD><TD width="510"> </TD><TD width="11"> </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>looks like i have a bad php editor...
copied and pasted into notepad, the ?> is there, saved it, uploaded it, same error.
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"> </TD></TR><TR><TD width="12"> </TD><TD width="510"> </TD><TD width="11"> </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>
Last edited by dwfait on Wed Aug 04, 2004 1:25 am, edited 1 time in total.
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:
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);
}
}
}
}
}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
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
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?
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?