Page 1 of 1

[SOLVED] Parse Error

Posted: Sun Jul 04, 2004 1:05 pm
by zatch
I cant find the blasted error

Code: Select all

<?
session_start();
if(!session_is_registered("client_id"))
{
header("Location: auth.php");
exit;
}
?>
<html>
<head><title="WDAccounts By TZN"></head>
<link rel="stylesheet" href="includes/style.css" type="text/css">

<body bgcolor="#FFFFFF">

<!--BEGIN CLIENT MODE-->

<?
if ($client_login !== 'admin')
{
?>
<table width="100%"><tr><td width="100%" bgcolor="#bbddff">
<h2>Hello <b> 
  <? echo $client_name ?>
  </b> </h2><br>
   <center><font size=4 face=verdana>Welcome to Your Online Account Manager</font><br><br></center>
</tr></td><tr><td width="100%" height="2" bgcolor="#000000"></td></tr></table><br>
<font face=arial size=3><b>Invoice Manager</b></font>
<table>
<?
include "includes/dbconnect.php";
include ("includes/date.php");
$result = mysql_query("SELECT * FROM invoices WHERE clientid = '$client_id' ORDER BY $param",$db);
if (!$param) {
$result = mysql_query("SELECT * FROM invoices WHERE clientid = '$client_id' ORDER BY id",$db);
}
echo "<p><table border=1 cellspacing=0 cellpadding=2 bordercolor=#eeeeee width=400>";
echo "<tr align=top><td><b><a href='main.php?param=id'>Invoice number</a></b></td><td><b><a href='main.php?param=domain'>Domain</a></b></td><td><b><a href='main.php?param=date'>Date</a></b></td><td><b><a href='main.php?param=total'>Total</a></b></td><td><b><a href='main.php?param=status'>Status</a></b></td><td>&nbsp</td></tr>";

while ($row = mysql_fetch_array($result))
{
	$id = $row["id"];
	$domain = $row["domain"];
	$date = $row["date"];
	$dateshow = fixDate($date);
	$total = $row["total"];
	$status = $row["status"];

if ($alternate == "1") { 
	$color = "#ffffff"; 
	$alternate = "2"; 
	} 
	else { 
	$color = "#efefef"; 
	$alternate = "1"; 
	} 
}
echo "<tr valign=top bgcolor=$color><td>$id</td><td>$dateshow</td><td>$total</td><td>$status</td><td>[ <a href='invoice.php?id=$id'>view</a> ]</td></tr>";
?>
</table>
<br><br><br>
<font face=arial size=3><b>Status Manager</b></font>
<?
include "includes/dbconnect.php";
include ("includes/date.php");
$result = mysql_query("SELECT * FROM projects WHERE clientid = '$client_id' ORDER BY $param",$db);
if (!$param) {
$result = mysql_query("SELECT * FROM projects WHERE clientid = '$client_id' ORDER BY id",$db);
}
echo "<p><table border=1 cellspacing=0 cellpadding=2 bordercolor=#eeeeee width=400>";
echo "<tr align=top><td><b><a href='main.php?param=id'>Project number</a></b></td><td><b><a href='main.php?param=date'>Date</a></b></td><td><b><a href='main.php?param=details'>Update</a></b></td><td>&nbsp</td></tr>";

while ($row = mysql_fetch_array($result))
{
	$projectid = $row["id"];
	$date = $row["date"];
	$dateshow = fixDate($date);
	$details = $row["details"];

if ($alternate == "1") { 
	$color = "#ffffff"; 
	$alternate = "2"; 
	} 
	else { 
	$color = "#efefef"; 
	$alternate = "1"; 
	} 

echo "</table>";
} 
?>

<?                                                     //IT SAYS THE PARSE ERROR IS AROUND HERE
elseif ($client_login == 'admin')
 {
?>

<center><font size=4 face=verdana>Welcome to Your Online Administration Panel</font><br><br></center>
<?
include "includes/dbconnect.php";
include ("includes/date.php");
$result = mysql_query("SELECT * FROM invoices ORDER BY $param",$db);
if (!$param) {
$result = mysql_query("SELECT * FROM invoices ORDER BY id",$db);
}
echo "<p><table border=1 cellspacing=0 cellpadding=2 bordercolor=#eeeeee width=400>";
echo "<tr align=top><td><b><a href='main.php?param=id'>Invoice number</a></b></td><td><b><a href='main.php?param=date'>Date</a></b></td><td><b><a href='main.php?param=clientid'>Client</a></b></td><td><b><a href='main.php?param=domain'>Domain</a></b></td><td><b><a href='main.php?param=total'>Total</a></b></td><td><b><a href='main.php?param=status'>Status</a></b></td><td>&nbsp</td></tr>";

while ($row = mysql_fetch_array($result))
{
	$id = $row["id"];
	$date = $row["date"];
	$dateshow = fixDate($date);
	$clientid = $row["clientid"];
	$domain = $row["domain"];
	$clientfind = mysql_query("SELECT title FROM clients WHERE clientid = '$clientid'",$db);
	$clienttitle = mysql_result($clientfind,0);
	$total = $row["total"];
	$status = $row["status"];

if ($alternate == "1") { 
	$color = "#ffffff"; 
	$alternate = "2"; 
	} 
	else { 
	$color = "#efefef"; 
	$alternate = "1"; 
	} 
echo "<tr valign=top bgcolor=$color><td>$id</td><td>$clienttitle</td><td>$dateshow</td><td>$total</td><td>$status</td>";
if ($status == 'pending') {
echo "<td>[ <a href='invoiceadmin.php?id=$id'>view / change status</a> ]</td>";
}
else {
echo "<td>[ <a href='invoiceadmin.php?id=$id'>view</a> ]</td>";
}
echo "<td>[ <a href='editinvoice.php?id=$id'>edit</a> ]</td><td>[ <a href='deleteinvoice.php?id=$id' onClick="return confirm('Are you sure?')">delete</a> ]</td></tr>";
}
echo "</table>";

echo "<p><a href='editinvoice.php'>Invoice Administration</a> | <a href='clients.php'>Client Administration</a>";


} //END ADMIN MODE
?>

<p><a href="logout.php">Logout</a></p>

<?
include "includes/footer.inc";
?>

</body>
 </html>

Posted: Sun Jul 04, 2004 1:14 pm
by feyd
what's the error you are getting, and which line is the error saying it's from?

Posted: Sun Jul 04, 2004 1:15 pm
by zatch
I posted it on the code ,, the error is at line 93 or so

Code: Select all

<?
elseif ($client_login == 'admin')
 {
?>

Posted: Sun Jul 04, 2004 1:18 pm
by ol4pr0
Maby this will do what you want.

for the few lines of html which you are using, personally i find it more clearer to use

Code: Select all

echo '<html><head><title>Title</title></head>';
Instead of jumping in and out of php.

Code: Select all

<?
session_start();
if(!session_is_registered("client_id"))
{
header("Location: auth.php");
exit;
}
?>
<html>
<head><title="WDAccounts By TZN"></head>
<link rel="stylesheet" href="includes/style.css" type="text/css">

<body bgcolor="#FFFFFF">

<!--BEGIN CLIENT MODE-->

<?
if ($client_login !== 'admin')
{
?>
<table width="100%"><tr><td width="100%" bgcolor="#bbddff">
<h2>Hello <b>
  <? echo $client_name ?>
  </b> </h2><br>
   <center><font size=4 face=verdana>Welcome to Your Online Account Manager</font><br><br></center>
</tr></td><tr><td width="100%" height="2" bgcolor="#000000"></td></tr></table><br>
<font face=arial size=3><b>Invoice Manager</b></font>
<table>
<?
include "includes/dbconnect.php";
include ("includes/date.php");
$result = mysql_query("SELECT * FROM invoices WHERE clientid = '$client_id' ORDER BY $param",$db);
if (!$param) {
$result = mysql_query("SELECT * FROM invoices WHERE clientid = '$client_id' ORDER BY id",$db);
}
echo "<p><table border=1 cellspacing=0 cellpadding=2 bordercolor=#eeeeee width=400>";
echo "<tr align=top><td><b><a href='main.php?param=id'>Invoice number</a></b></td><td><b><a href='main.php?param=domain'>Domain</a></b></td><td><b><a href='main.php?param=date'>Date</a></b></td><td><b><a href='main.php?param=total'>Total</a></b></td><td><b><a href='main.php?param=status'>Status</a></b></td><td>&nbsp</td></tr>";

while ($row = mysql_fetch_array($result))
{
   $id = $row["id"];
   $domain = $row["domain"];
   $date = $row["date"];
   $dateshow = fixDate($date);
   $total = $row["total"];
   $status = $row["status"];

if ($alternate == "1") {
   $color = "#ffffff";
   $alternate = "2";
   }
   else {
   $color = "#efefef";
   $alternate = "1";
   }
}
echo "<tr valign=top bgcolor=$color><td>$id</td><td>$dateshow</td><td>$total</td><td>$status</td><td>[ <a href='invoice.php?id=$id'>view</a> ]</td></tr>";
?>
</table>
<br><br><br>
<font face=arial size=3><b>Status Manager</b></font>
<?
include "includes/dbconnect.php";
include ("includes/date.php");
$result = mysql_query("SELECT * FROM projects WHERE clientid = '$client_id' ORDER BY $param",$db);
if (!$param) {
$result = mysql_query("SELECT * FROM projects WHERE clientid = '$client_id' ORDER BY id",$db);
}
echo "<p><table border=1 cellspacing=0 cellpadding=2 bordercolor=#eeeeee width=400>";
echo "<tr align=top><td><b><a href='main.php?param=id'>Project number</a></b></td><td><b><a href='main.php?param=date'>Date</a></b></td><td><b><a href='main.php?param=details'>Update</a></b></td><td>&nbsp</td></tr>";

while ($row = mysql_fetch_array($result))
{
   $projectid = $row["id"];
   $date = $row["date"];
   $dateshow = fixDate($date);
   $details = $row["details"];

if ($alternate == "1") {
   $color = "#ffffff";
   $alternate = "2";
   }
   else {
   $color = "#efefef";
   $alternate = "1";
   }

echo "</table>";
}
                                                   //IT SAYS THE PARSE ERROR IS AROUND HERE
if ($client_login == 'admin')
{
?>

<center><font size=4 face=verdana>Welcome to Your Online Administration Panel</font><br><br></center>
<?
include "includes/dbconnect.php";
include ("includes/date.php");
$result = mysql_query("SELECT * FROM invoices ORDER BY $param",$db);
if (!$param) {
$result = mysql_query("SELECT * FROM invoices ORDER BY id",$db);
}
echo "<p><table border=1 cellspacing=0 cellpadding=2 bordercolor=#eeeeee width=400>";
echo "<tr align=top><td><b><a href='main.php?param=id'>Invoice number</a></b></td><td><b><a href='main.php?param=date'>Date</a></b></td><td><b><a href='main.php?param=clientid'>Client</a></b></td><td><b><a href='main.php?param=domain'>Domain</a></b></td><td><b><a href='main.php?param=total'>Total</a></b></td><td><b><a href='main.php?param=status'>Status</a></b></td><td>&nbsp</td></tr>";

while ($row = mysql_fetch_array($result))
{
   $id = $row["id"];
   $date = $row["date"];
   $dateshow = fixDate($date);
   $clientid = $row["clientid"];
   $domain = $row["domain"];
   $clientfind = mysql_query("SELECT title FROM clients WHERE clientid = '$clientid'",$db);
   $clienttitle = mysql_result($clientfind,0);
   $total = $row["total"];
   $status = $row["status"];

if ($alternate == "1") {
   $color = "#ffffff";
   $alternate = "2";
   }
   else {
   $color = "#efefef";
   $alternate = "1";
   }
echo "<tr valign=top bgcolor=$color><td>$id</td><td>$clienttitle</td><td>$dateshow</td><td>$total</td><td>$status</td>";
if ($status == 'pending') {
echo "<td>[ <a href='invoiceadmin.php?id=$id'>view / change status</a> ]</td>";
}
else {
echo "<td>[ <a href='invoiceadmin.php?id=$id'>view</a> ]</td>";
}
echo "<td>[ <a href='editinvoice.php?id=$id'>edit</a> ]</td><td>[ <a href='deleteinvoice.php?id=$id' onClick="return confirm('Are you sure?')">delete</a> ]</td></tr>";
}
echo "</table>";

echo "<p><a href='editinvoice.php'>Invoice Administration</a> | <a href='clients.php'>Client Administration</a>";


} //END ADMIN MODE
}
?>

<p><a href="logout.php">Logout</a></p>

<?
include "includes/footer.inc";
?>

</body>
</html>

Posted: Sun Jul 04, 2004 1:18 pm
by feyd
I don't see an if that corresponds to that elseif.

Posted: Sun Jul 04, 2004 1:20 pm
by zatch
FEYD - Here is the if

Code: Select all

<? 
if ($client_login !== 'admin') 
{ 
?>

Posted: Sun Jul 04, 2004 1:22 pm
by zatch
SOLVED!

Code: Select all

if ($client_login == 'admin') 
{ 
?>
was the key

Posted: Sun Jul 04, 2004 1:23 pm
by ol4pr0
that should be

Code: Select all

if ($client !='admin')
{
#correct me if i am wrong

Posted: Sun Jul 04, 2004 1:23 pm
by feyd
then you didn't close that if's block.

Posted: Sun Jul 04, 2004 1:24 pm
by zatch
Yeah - I got if figured out now. Thanks, you guys rock!

SOVLED