gpt4 book ai didi

PHP 页面无法正确显示

转载 作者:行者123 更新时间:2023-11-29 13:54:10 26 4
gpt4 key购买 nike

我已经为在线游戏上的招聘申请编写了表格,但当我实际将代码放在网站上时遇到了一些问题。在我的本地 apache Web 服务器上运行此操作运行良好,但在在线 LiteSpeed Web 服务器上执行此操作似乎不起作用。代码中是否存在无效内容?

我已经设置了代码来检测任何错误(我已从下面的示例中删除了该错误),但除了 undefined variable 之外什么也没有出现(在本例中这很好)。

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

最佳答案

请添加

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

就在

之前
require('includes.php');

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

关于PHP 页面无法正确显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16141216/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com