将PHP网站更改为新服务器后,这些错误仍然存在。
1st - 由" shaddy"
解决Notice: Undefined variable: es in /home/musthand/public_html/external/site/header.php on line 2
<?php
if(!is_object($es))
{
require_once('includes/EliteScript.php');
$es = new EliteScript();
$sMemberId = $es->getMemberId();
}
// Get the base URL
$sBaseUrl = $es->getConfig('baseUrl');
$sImageUrl = $es->getConfig('imageUrl');
$sMemberId = $es->getMemberId();
$sUsername = $es->getMemberUsername($sMemberId);
$sIP = $_SERVER['REMOTE_ADDR'];
// Vars we want to pass to the system
$aJSVars = array(
'member_url' => $es->getConfig('memberUrl'),
'base_url' => $es->getCOnfig('baseUrl'),
'image_url' => $es->getConfig('imageUrl'),
'date' => date("F d, Y H:i:s", time()),
);
$ba = new BannerAd();
?>
第二
Fatal error: Class 'FOrum' not found in /home/musthand/public_html/interface/forum.php on line 33
<?php
global $es;
global $ui;
global $member_id;
global $base_url;
global $member_url;
global $image_url;
global $admin_url;
require_once("includes/EliteScript.php");
$es = new EliteScript();
$ui = new UserInterface();
$es->RequireMember();
$member_id = $es->GetMemberId();
$base_url = $es->GetConfig("baseUrl");
$member_url = $es->GetConfig("memberUrl");
$image_url = $es->GetConfig("imageUrl");
$es->DisplayHeader("Forum", "member.php");
$_REQUEST["do"];
display_main();
$es->DisplayFooter();
function display_main()
{
global $es;
global $ui;
global $member_id;
global $base_url;
global $member_url;
global $image_url;
global $admin_url;
$cur_sign = $es->GetCurrencySign();
$f = new FOrum();
echo "<script>\n</script>\n\n<div class=\"bigHeader\">Forum</div>\n";
echo $ui->GenerateMessageBox("msg", 0, 5);
echo $ui->GenerateErrorBox("err", 0, 5);
echo "\n";
echo $ui->DisplayToolTip("Forum", "Below you can participate in the company forum.");
echo "<br>\n\n\n";
$q = "SELECT * FROM forumSections ORDER BY id";
$r = mysql_query($q);
while( $l = mysql_fetch_array($r) )
{
$l_sid = $l["id"];
$l_sec_name = htmlentitiesi($l["name"]);
echo "<div class=\"header\">";
echo $l_sec_name;
echo "</div>\n<table cellspacing=\"1\" cellpadding=\"0\" border=\"0\" width=\"100%\" class=\"dataTbl\">\n<tr class=\"tblHeader\">\n<td>Forum</td>\n<td width=\"50\" align=\"center\">Topics</td>\n<td width=\"50\" align=\"center\">Replies</td>\n<td width=\"150\" align=\"right\">Last Post Info</td>\n</tr>\n";
$html = NULL;
$qb = "SELECT * FROM forums WHERE sectionId='" . $l_sid . "' ORDER BY id";
$rb = mysql_query($qb);
while( $lb = mysql_fetch_array($rb) )
{
$l_fid = $lb["id"];
$l_name = htmlentitiesi($lb["name"]);
$l_desc = htmlentitiesi($lb["description"]);
$l_topics = $f->GetForumTopicCount($l_fid);
$l_replies = $f->GetForumReplyCount($l_fid);
$html .= "<tr class=\"tblRowA\">\n\t\t\t<td style=\"padding: 5px 0px 5px 5px;\">\n\t\t\t<a href=\"\"><b>" . $l_name . "</b></a>\n\t\t\t<div style=\"padding-top: 5px;\">\n\t\t\t" . $l_desc . "\n\t\t\t</div>\n\t\t\t\n\t\t\t</td>\n\t\t\t<td align=\"center\">" . $l_topics . "</td>\n\t\t\t<td align=\"center\">" . $l_replies . "</td>\n\t\t\t<td align=\"right\">" . $l_lastpost . "</td>\n\t\t\t</tr>";
}
echo $html;
echo "</table>\n\n";
}
echo "\n\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n\n\n\n\n\n<div class=\"header\">News & Updates</div>\n<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\">\n";
$html = NULL;
$q = "SELECT * FROM news ORDER BY added DESC,id DESC LIMIT 5";
$r = mysql_query($q);
while( $l = mysql_fetch_array($r) )
{
$l_id = $l["id"];
$l_title = htmlentitiesi($l["title"]);
$l_date = date("M jS", strtotime($l["added"]));
$html .= "<tr class=\"sepLine\"><td width=\"20\"><img src=\"" . $image_url . "/note.png\" width=\"16\" height=\"16\"></td><td><a href=\"" . $member_url . "/news.php?do=view&id=" . $l_id . "\">" . $l_title . "</a> <i style=\"color:gray;\">(" . $l_date . ")</i></td></tr>\n";
}
if( !$html )
{
$html = "<tr class=\"sepLine\"><td style=\"color: gray;\">Currently no news and updates...</td></tr>";
}
echo $html;
echo "</table>\n<br>\n\n<div class=\"header\">Account Summary</div>\n\n<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\">\n<tr class=\"sepLine\">\n<td width=\"20\"><img src=\"";
echo $image_url;
echo "/user.png\" width=\"16\" height=\"16\"></td>\n<td width=\"175\"><b>Member Info:</b></td>\n<td>";
echo $username;
echo " (#";
echo $member_id;
echo ") <i>(<a href=\"mailto:";
echo $email;
echo "\">";
echo $email;
echo "</a>)</i></td>\n<td align=\"right\"><a href=\"";
echo $member_url;
echo "/preferences.php\">[Preferences]</a></td>\n</tr>\n</table>\n\n<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\">\n<tr><td class=\"toolTip\">\nYou must ";
echo $req_text;
echo " before participating.</td></tr>\n</table>\n\n\n\n\n<div class=\"header\">Current Active ";
echo $token_label;
echo "s</div>\n\n<table cellspacing=\"1\" cellpadding=\"0\" border=\"0\" width=\"100%\" class=\"dataTbl\">\n<tr class=\"tblHeader\">\n<td width=\"50\">ID</td>\n<td>Type</td>\n<td width=\"40\">Units</td>\n<td width=\"80\">Amount</td>\n<td width=\"150\">Earned So Far</td>\n<td width=\"80\">Created</td>\n</tr>\n\n";
$tok_types = $es->GetConfig("tokenTypes");
$html = NULL;
$tblClass = "tblRowA";
$q = "SELECT * FROM tokens WHERE memberId='" . $member_id . "' AND status = 'ACTIVE' ORDER BY created DESC,id DESC";
$r = mysql_query($q);
while( $l = mysql_fetch_array($r) )
{
$l_id = $l["id"];
$l_type = $l["type"];
$tok_arr = $tok_types[$l_type];
$l_name = htmlentitiesi($tok_arr["name"]);
$l_amt = $l["amount"];
$l_esf = $l["earnedSoFar"];
$l_exp_type = $l["expireType"];
$l_exp_val = $l["expiresOnValue"];
$l_created = $l["createdDate"];
$l_lastroi = $l["lastRoiDate"];
$l_incycle = $l["inCycle"];
$l_status = $l["status"];
if( $l_status == "ACTIVE" )
{
$lb_status = "<span style=\"color: darkgreen;\">Active</span>";
}
else
{
if( $l_status == "EXPIRED" )
{
$lb_status = "<span style=\"color: red;\">Expired</span> as of " . date("M jS, y", strtotime($l["expiresDate"]));
}
}
if( $l_created == $l_lastroi && $l_incycle <= 1 )
{
$l_lastearn_text = "Never";
}
else
{
$l_lastearn_text = date("M jS, y", strtotime($l_lastroi));
}
$l_units = sprintf("%d", $l["units"]);
$l_earned_per = sprintf("%.2f", $l_esf / $l_amt * 100);
$earned_per_style = "color: gray;";
if( 100 < $l_earned_per )
{
$earned_per_style = "color: darkgreen;";
}
$l_created_date = date("M jS, y", $l["created"]);
if( $l_exp_type == "value" )
{
$l_exp_text = sprintf("%.2f", $l_exp_val) . "%";
$l_exp_text .= " <i>(" . $cur_sign . sprintf("%.2f", $l_amt * $l_exp_val / 100) . ")</i>";
}
else
{
if( $l_exp_type == "date" )
{
$l_exp_text = date("M jS, y", $l["expires"]);
}
else
{
if( $l_exp_type == "never" )
{
$l_exp_text = "No Set Expiry";
}
}
}
$lb_amt = number_format($l_amt, 2);
$lb_esf = number_format($l_esf, 2);
$html .= "\n\t\t<tr class=\"" . $tblClass . "\">\n\t\t<td>#" . $l_id . "</td>\n\t\t<td><b>" . $l_name . "</b></td>\n\t\t\n\t\t<td>" . $l_units . "</td>\n\t\t<td>" . $cur_sign . $lb_amt . "</td>\n\t\t<td>" . $cur_sign . $lb_esf . " <i style=\"" . $earned_per_style . "\">(" . $l_earned_per . "%)</i></td>\n\t\t<td>" . $l_created_date . "</td>\n\t\t</tr>\n\t\t<tr class=\"" . $tblClass . "\">\n\t\t<td colspan=\"6\" style=\"padding-left: 20px;\">\n\t\t\n\t\t<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n\t\t<tr><td width=\"170\">\n\t\t<u>Last Earn Date:</u> " . $l_lastearn_text . "\n\t\t</td><td width=\"190\">\n\t\t<u>Expires:</u> " . $l_exp_text . "\n\t\t</td><td>\n\t\t<u>Status:</u> " . $lb_status . "\n\t\t</td></tr>\n\t\t</table>\n\t\t\n\t\t</td>\n\t\t</tr>";
$tblClass = $tblClass == "tblRowA" ? "tblRowB" : "tblRowA";
}
if( !$html )
{
$html .= "<tr class=\"" . $tblClass . "\"><td colspan=\"7\"><span style=\"color: gray;\">Currently no active " . $token_label . "s...</span></td></tr>";
}
echo $html;
echo "</table>\n\n<br><br>\n\n";
}
?>
他们曾经在旧服务器上正常工作,我不知道新服务器上的这些错误是什么。
他们在某个文件中的某处定义了,有800多个文件,并且很难在每个文件中进行搜索。
有没有什么办法可以让服务器看起来定义了这些类或变量的实际文件?
答案 0 :(得分:0)
您的代码从未运作良好。写的很糟糕。您在旧服务器中没有看到错误的原因是您的错误报告较低或者关闭了整个错误报告。当你正在开发一些东西时,你应该随时开启错误报告,这样你就可以看到你的错误。
第一个问题在这里
if(!is_object($es)) {
你直接检查$es
是否是对象,但是这是错误的,因为这个语句位于文件的顶部,除非你从全局范围导入它,否则$es
将是未定义的,像这样:
global $es;
if(!is_object($es)) {
您的第二个错误是因为您错误地引用了Forum
类:
$f = new FOrum();
我想它应该是:
$f = new Forum();