PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
zatch
Forum Newbie
Posts: 18 Joined: Fri Jul 02, 2004 7:05 pm
Post
by zatch » Sun Jul 04, 2004 1:05 pm
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> </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> </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> </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>
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sun Jul 04, 2004 1:14 pm
what's the error you are getting, and which line is the error saying it's from?
zatch
Forum Newbie
Posts: 18 Joined: Fri Jul 02, 2004 7:05 pm
Post
by zatch » Sun Jul 04, 2004 1:15 pm
I posted it on the code ,, the error is at line 93 or so
Code: Select all
<?
elseif ($client_login == 'admin')
{
?>
ol4pr0
Forum Regular
Posts: 926 Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador
Post
by ol4pr0 » Sun Jul 04, 2004 1:18 pm
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> </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> </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> </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>
Last edited by
ol4pr0 on Sun Jul 04, 2004 1:20 pm, edited 1 time in total.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sun Jul 04, 2004 1:18 pm
I don't see an if that corresponds to that elseif.
zatch
Forum Newbie
Posts: 18 Joined: Fri Jul 02, 2004 7:05 pm
Post
by zatch » Sun Jul 04, 2004 1:20 pm
FEYD - Here is the if
Code: Select all
<?
if ($client_login !== 'admin')
{
?>
zatch
Forum Newbie
Posts: 18 Joined: Fri Jul 02, 2004 7:05 pm
Post
by zatch » Sun Jul 04, 2004 1:22 pm
SOLVED!
Code: Select all
if ($client_login == 'admin')
{
?>
was the key
ol4pr0
Forum Regular
Posts: 926 Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador
Post
by ol4pr0 » Sun Jul 04, 2004 1:23 pm
that should be
Code: Select all
if ($client !='admin')
{
#correct me if i am wrong
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sun Jul 04, 2004 1:23 pm
then you didn't close that if's block.
zatch
Forum Newbie
Posts: 18 Joined: Fri Jul 02, 2004 7:05 pm
Post
by zatch » Sun Jul 04, 2004 1:24 pm
Yeah - I got if figured out now. Thanks, you guys rock!
SOVLED