0

在此处输入图像描述

<?

session_start();

$client_name=$_SESSION['client_name'];

if ($client_name !== 'admin')
{
include "client_header.php";
$client_id=$_SESSION['client_id'];
$first_name=$_SESSION['first_name'];
$last_name=$_SESSION['last_name'];
$remoteaddr=$_SESSION['remoteaddr'];
$date_in=$_SESSION['date_in'];
$time_in=$_SESSION['time_in'];
$cisloggedin=$_SESSION['cisloggedin'];

$url_access=$_SERVER['REQUEST_URI'] ;

$isql = "INSERT INTO patient (first_name,last_name, email, country , address , phone , gender , height , weight , bloodpressure , bloodtype)
VALUES ('$first_name','$last_name','$email','$country','$address','$phone','$gender','$height','$weight','$bloodpressure','$bloodtype')";
$result = mysql_query($isql);
?>
<h2><br>Welcome <b>
  <?=$client_name?>

  Here are your bills:
  </b></h2>

<?

$result = mysql_query("SELECT * FROM invoices WHERE clientid = '$client_id' ORDER BY id",$db);

echo "<p><table border=1 cellspacing=0 cellpadding=2 bordercolor=#000000 width=90%>";
echo "<tr align=top>
<td class=topHeadrow5><b>Inv. #</b></td>
<td class=topHeadrow5><b>Receipt Date</b></td>
<td class=topHeadrow5><b>Due Date</b></td>
<td class=topHeadrow5><b>Total</b></td>
<td class=topHeadrow5><b>Status</b></td>
<td class=topHeadrow5>&nbsp;</td></tr>";

while ($row = mysql_fetch_array($result))
{
    $id = $row["id"];
    $date = $row["date"];
    $bill_date = $row["bill_date"];
    $due_date = $row["due_date"];
    $paid_date = $row["paid_date"];
    $dateshow = fixDate($date);
    $dateshow1 = fixDate($bill_date);
    $dateshow2 = fixDate($due_date);
    $dateshow3 = fixDate($paid_date);
    $total = $row["total"];
    $status = $row["status"];

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

echo "<tr valign=top bgcolor=$color><td>$id</td><td>$dateshow</td><td>$dateshow2</td><td align=right>$currency$total</td>";
if($status == "paid"){
echo "<td bgcolor=#33cc33>$status</td>";
}else{
echo "<td>$status</td>";
}
echo "<td>[ <a href='invoice.php?id=$id'>view</a> ] [ <a target=_blank href='invoice_print.php?id=$id'>Print</a> ]</td></tr>";
}
echo "</table>";
//-------------------------------------------------Begin Admin-------------------------------------------------
}
elseif ($client_name == 'admin')
{
include "header.php";

$url_access=$_SERVER['REQUEST_URI'] ;

?>
<h2><br>Hello <b>
  <?=$client_name?>

  Patients List:
  </b></h2>

<?

if ($menusort1 = $menusort1) {
$result = mysql_query("SELECT invoices.*, clients.*
FROM invoices,clients
WHERE invoices.clientid = clients.clientid && invoices.date >'$ytd'
ORDER BY $menusort1 ASC",$db);

}
if ($menusort = $menusort) {
$result = mysql_query("SELECT invoices.*, clients.*
FROM invoices,clients
WHERE invoices.clientid = clients.clientid && invoices.date >'$ytd'
ORDER BY $menusort DESC",$db);

}
if (!$menusort and !$menusort1) {
$result = mysql_query("SELECT invoices.*, patient.*
FROM invoices,patient
WHERE invoices.clientid = clients.clientid && invoices.date >'$ytd'
ORDER BY id",$db);
}
echo "<p><table border=1 cellspacing=0 cellpadding=2 bordercolor=#000000 width=95%>";
echo "<tr align=top>
<td class=topHeadrow5><b>ID number: <a href='menu.php?menusort=id'><img class=arrows src=images/dn_arrow.gif></a><a href='menu.php?menusort1=id'><img class=arrows src=images/up_arrow.gif></a></b></td>
<td class=topHeadrow5><b>Name <a href='menu.php?menusort=name'><img class=arrows src=images/dn_arrow.gif></a><a href='menu.php?menusort1=name'><img class=arrows src=images/up_arrow.gif></a></b></td>
<td class=topHeadrow5><b>Out Patient<a href='menu.php?menusort=date'><img class=arrows src=images/dn_arrow.gif></a><a href='menu.php?menusort1=date'><img class=arrows src=images/up_arrow.gif></a></b></td>
<td class=topHeadrow5><b>Due Date <a href='menu.php?menusort=due_date'><img class=arrows src=images/dn_arrow.gif></a><a href='menu.php?menusort1=due_date'><img class=arrows src=images/up_arrow.gif></a></b></td>
<td class=topHeadrow5>&nbsp;</td>
<td class=topHeadrow5>&nbsp;</td>
<td class=topHeadrow5>&nbsp;</td>
<td class=topHeadrow5>&nbsp;</td></tr>";

while ($row = mysql_fetch_array($result))
{
    $id = $row["id"];
    $clientid = $row["clientid"];
    $name = $row["first_name"];
    $date = $row["date"];
    $bill_date = $row["bill_date"];
    $due_date = $row["due_date"];
    $paid_date = $row["paid_date"];
    $dateshow = fixDate($date);
    $dateshow1 = fixDate($bill_date);
    $dateshow2 = fixDate($due_date);
    $dateshow3 = fixDate($paid_date);




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

echo "<tr valign=top bgcolor=$color>
<td width=10>$id</td><td>$name</td>
<td>$dateshow</td><td>$dateshow2</td>
<td align=right>$currency$total</td>";
if ($status == 'pending') {
echo "<td  bgcolor=$color>$status</td>";

} else {
echo "<td class=rowviewinv >$status</td>";
}
if ($status == 'pending') {
echo "<td>[ <a href='admin_invoice.php?id=$id'>view / change status</a> ]</td>";
}
else {
echo "<td class=rowviewinv>[ <a class=inv_links href='admin_invoice.php?id=$id'>view</a> ]</td>";
}
if ($status == 'pending') {
echo "<td>[ <a href='notifyclient.php?id=$id&clientid=$clientid'>notify client</a> ]</td>";
} else {
echo "<td class=rowviewinv>[ Paid $dateshow3 ]</td>";
}

echo "<td>[ <a href='edit_invoice.php?id=$id'>edit</a> ]</td><td>[ <a href='delete_invoice.php?id=$id' onClick=\"return confirm('Are you sure?')\">delete</a> ]</td></tr>";
}
$result = mysql_query("SELECT sum(total) AS sum FROM invoices WHERE date >'.$ytd.'");
$sum = mysql_result($result,0,"sum");

if ($sum == 1){
echo "";
}else{
echo "";
}
echo "</table>";

?>
<p align="center"><font class="medBold">You can review previous dates by selecting from the calendar icons.
</font></p>
<form method="post" name=form1 action="invoice_history.php">
<input type="text" name="invdate" id="invdate">
<img src="img.gif" id="f_trigger_c"
     style="cursor: pointer; border: 1px solid red;"
     title="Date selector"
     onmouseover="this.style.background='red';"
     onmouseout="this.style.background=''" />
<script type="text/javascript">
    Calendar.setup({
        inputField     :    "invdate",
        ifFormat       :    "%Y-%m-%d",
        button         :    "f_trigger_c",
        align          :    "Tl",
        singleClick    :    true
    });
</script>
<input type="Submit" name="submit" value="Submit Invoice Date"></form>
<?
}

?>

它以前工作得很好。我没有做任何事情,因为我不是编写代码的人。我所做的只是将文件复制到一个新文件夹,但两个文件都不起作用。在数据库中,我确实修改了一些,但不是在该程序正在使用的数据库中。

4

2 回答 2

3

include "client_header.php";

您缺少此文件,因此它可能会丢弃其余代码。您可能将这些文件移动到不同的目录,更改include以允许目录更改。

代码中还有其他include内容,因此也要更新它们。

// 编辑

检查原始来源,因为你说这是别人的代码,可能有副本存在。该include命令指示该client_header.php文件将可用,无论是在同一文件夹中还是作为PATH. 有关更多详细信息,请参阅PHP 包含文档和有关 include_path 的注释

唯一的另一种可能性是这些错误之前存在,但由于 php 设置不可见。

于 2012-12-14T16:51:57.580 回答
0

您移动了脚本,因此您需要更正包含路径:

include "client_header.php";

这期望包含在当前目录中,因此如果您已将其移至子目录,则可以为其添加前缀../或为其提供绝对路径。

于 2012-12-14T16:52:10.627 回答