我已經編寫了一個在線遊戲招聘應用程序的表單,但是當我真的把代碼放到網站上時發生了一些問題。在我的本地apache web服務器上運行這個運行正常,但是在LiteSpeed web服務器上執行此操作似乎不起作用。代碼中有無效的東西嗎?PHP頁面不能正確顯示
我已經設置了代碼來檢測任何錯誤(我已經從下面的示例中刪除了該錯誤),但除了未定義的變量(在這種情況下罰款)沒有任何變化。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<title>Zone Application Manager</title>
</head>
<body>
<?php
require("includes.php");
function displayElements($category) {
echo "<div id=\"left\">\n";
$col1 = mysql_query("SELECT * FROM gp_applications WHERE category = '$category' ORDER BY id ASC");
echo "<h3>" . $category . "</h3>\n";
echo "<form action=\"#\" method=\"get\">\n";
echo "<select name=\"category\">\n";
if ($category=="Unread Apps") {
echo "<option value=\"Unread Apps\" selected=\"selected\">Unread Apps</option>\n";
echo "<option value=\"Deleted Apps\">Deleted Apps</option>\n";
echo "<option value=\"Good Apps\">Good Apps</option>\n";
}
if ($category=="Deleted Apps") {
echo "<option value=\"Unread Apps\">Unread Apps</option>\n";
echo "<option value=\"Deleted Apps\" selected=\"selected\">Deleted Apps</option>\n";
echo "<option value=\"Good Apps\">Good Apps</option>\n";
}
if ($category=="Good Apps") {
echo "<option value=\"Unread Apps\">Unread Apps</option>\n";
echo "<option value=\"Deleted Apps\">Deleted Apps</option>\n";
echo "<option value=\"Good Apps\" selected=\"selected\">Good Apps</option>\n";
}
echo "</select>\n";
echo "<input type=\"submit\" value=\"Choose\">\n";
echo "</form>\n";
echo "<br />\n";
echo "<form action=\"#\" method=\"get\">\n";
echo "<input type=\"hidden\" name=\"category\" value=\"" . $category . "\">\n";
echo "<select name=\"id\" size=\"25\">\n";
while($row1 = mysql_fetch_array($col1)) {
echo "<option value=\"" . $row1[id] . "\">" . $row1[q2] . "</option>\n";
}
echo "</select>\n";
echo "<br />\n";
echo "<br />\n";
echo "<input type=\"submit\" name=\"read\" value=\"Read Application\">\n";
echo "<br />\n";
echo "<input type=\"submit\" name=\"delete\" value=\"Delete Application\">\n";
echo "<br />\n";
echo "<input type=\"submit\" name=\"unread\" value=\"Mark Application Unread\">\n";
echo "<br />\n";
echo "<input type=\"submit\" name=\"good\" value=\"Good Application\">\n";
echo "</div>\n";
echo "</form>";
echo "<form action=\"#\" method=\"get\">\n";
echo "<div id=\"bottom\">\n";
echo "<select name=\"appMode\">";
$mode = file_get_contents('mode.txt');
if($mode=="yes") {
echo "<option value=\"appon\" selected=\"selected\">Turn Application On</option>";
echo "<option value=\"appoff\">Turn Application Off</option>";
} else {
echo "<option value=\"appon\">Turn Application On</option>";
echo "<option value=\"appoff\" selected=\"selected\">Turn Application Off</option>";
}
echo "</select>";
echo "<input type=\"submit\" name=\"appModeBtn\" value=\"Toggle App Mode\">";
echo "</div>";
echo "</form>";
}
function executeAppAction($id) {
if (isset($_GET['good'])) {
mysql_query("UPDATE gp_applications SET category='Good Apps' WHERE id='$id'")or die(mysql_error());
header("Location: admin.php?action=admin");
}
if (isset($_GET['unread'])) {
mysql_query("UPDATE gp_applications SET category='Unread Apps' WHERE id='$id'")or die(mysql_error());
header("Location: admin.php");
}
if (isset($_GET['delete'])) {
mysql_query("UPDATE gp_applications SET category='Deleted Apps' WHERE id='$id'")or die(mysql_error());
header("Location: admin.php");
}
if (isset($_GET['read'])) {
$result = mysql_query("SELECT * FROM gp_applications WHERE id='$id'");
if ($result) {
$row = mysql_fetch_assoc($result);
}
echo "<div id=\"formBody\">";
//application opener, not needed to view
echo "</div>\n";
}
}
if($_POST['pwd'] || isset($_COOKIE['zonegp_application_login'])) {
if($_POST['pwd']=="xxxx") {
$hour = time() + 3600;
$pwd = $_POST['pwd'];
setcookie('zonegp_application_login', $pwd, $hour);
}
if($_COOKIE['zonegp_application_login']=="xxxx" || $_POST['pwd']=="xxxx") {
echo "<h1>The Doctor's Application Manager</h1>\n";
echo "<p><a href=\"logout.php\">Logout</a></p>\n";
if($_GET['category']) {
$appcategory = $_GET['category'];
}
if(empty($appcategory)) {
$appcategory = "Unread Apps";
displayElements($appcategory);
}
else {
displayElements($appcategory);
}
if($_GET['id']) {
$id = $_GET['id'];
executeAppAction($id);
}
if ($_GET['appModeBtn']) {
if($_GET['appMode']=="appon") {
$myFile = "mode.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "yes";
fwrite($fh, $stringData);
fclose($fh);
header("Location: admin.php");
}
if($_GET['appMode']=="appoff") {
$myFile = "mode.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "no";
fwrite($fh, $stringData);
fclose($fh);
header("Location: admin.php");
}
}
}
else {
echo "Incorrect Password";
}
}
else {
header("Location: login.html");
}
?>
</body>
</html>
本地託管: 在線託管:
是的,我運行PHP的網站版本。
你*肯定*有沒有錯誤?如果錯誤發生在
最有可能'require(「includes.php」);':includes.php從服務器丟失。看到你的CSS正在加載,只有在需要時纔會停止。如果它在那裏然後查找該文件中的錯誤 – 2013-04-22 08:18:00
我看到require include文件中沒有錯誤,因爲該文件在那裏,當它實際上提交具有相同包含文件的應用程序時,它也能正常工作。 – baseman101 2013-04-22 21:34:25