0

我已经为在线游戏上的招聘应用程序编写了一个表格,但是当我实际将代码放在网站上时遇到了一些问题。在我的本地 apache 网络服务器上运行它运行良好,但在 LiteSpeed 网络服务器上在线运行似乎不起作用。代码中有什么无效的吗?

我已经设置了代码来检测任何错误(我已经从下面的示例中删除了它),但是除了未定义的变量(在这种情况下很好)之外什么都没有出现。

<!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>

本地https://dl.dropboxusercontent.com/u/63673315/sopic1.png 托管: 在线托管:https://dl.dropboxusercontent.com/u/63673315/sopic2.png

是的,我在网站版本上运行 PHP。

4

1 回答 1

1

请加

var_dump(file_exists('includes.php'));

就在之前

require('includes.php');

如果找不到文件,require 会删除任何进一步的代码

于 2013-04-22T07:17:42.980 回答