オンライン ゲームで求人応募用のフォームをコーディングしましたが、実際にコードを Web サイトに配置すると問題が発生します。これをローカルの apache Web サーバーで実行すると問題なく動作しますが、LiteSpeed Web サーバーをオンラインで実行するとうまくいかないようです。コードに無効なものはありますか?
エラーを検出するようにコードを既に設定しました (以下のサンプルから削除しました) が、未定義の変数 (この場合は問題ありません) 以外は何も表示されません。
<!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>
はい、Web サイト版で PHP を実行しています。