-1

我正在尝试安装用 php 和 mysql 制作的 Web 应用程序。

我将 install.php 文件加载到浏览器中,它要求输入用户名和密码(用于网站管理员)。

提交后显示404错误:

在此服务器上找不到请求的 URL /website/Array。

并且错误日志显示:

文件不存在:D:/wamp/www/website/Array,引用者:http://localhost/website/install.php

那个数组文件是什么?

至于 install.php 脚本,它会在 mysql 中创建所需的表,并向其中插入用户名和密码。

install.php 脚本(使用西班牙语)

   <?php

/***********************************************************************

Install script

***********************************************************************/

include_once( "config.php" );

if ( isset($send) )
// We have already sent the admin data
{
require("common.php");
// We make avaiable the database
$db = new database()
or die("La base de datos está sobrecargada, por favor intentalo más tarde");

echo "Eliminando las anteriores bases de datos si existieran<br><br>";
$query = "DROP TABLE `League` , `Matches` , `Messages` , `Modules` , `Players` ,           `Teams` , `Users` ;";
 $db->doQuery ($query);

 echo "Creando las bases de datos...<br><br>";

 // Users Table
 $query = "CREATE TABLE Users (uname CHAR(16) NOT NULL, pass CHAR(50), team INT, admin     BIT,";
$query .= "email CHAR(30), language CHAR(5), skin CHAR(16), KEY(uname));";
 $db->doQuery ($query);

 $pass = md5($pass);
 $query = "INSERT INTO Users (uname, pass, admin, email, language, skin) VALUES ";
 $query .= "('$user', '$pass', '1', '', 'es', 'default');";
 $db->doQuery ($query);

 // Players table
 $query = "CREATE TABLE Players (id INT NOT NULL AUTO_INCREMENT, name CHAR(30), team INT, uname CHAR(16), defence INT(7),";
  $query .= " pass INT(7), shoot INT(7), keeping INT(7), endurance INT(7), physicalForm INT(7), weeksInjured INT UNSIGNED, matchesPlayed INT UNSIGNED, goals INT, KEY(id) );";
  $db->doQuery ($query);


 // Match table
  $query = "CREATE TABLE Matches (id INT NOT NULL AUTO_INCREMENT, home INT,";
  $query .= " away INT, played BIT, scoreHome INT, scoreAway INT, commentary LONGTEXT,";
  $query .= " week INT, KEY(id) );";
  $db->doQuery ($query);


  // Teams table
   $query = "CREATE TABLE Teams (id INT NOT NULL AUTO_INCREMENT, teamName CHAR(30),uname CHAR(16) NOT NULL,";
   $query .= " tactic CHAR(8),N1 INT, N2 INT, N3 INT, N4 INT, N5 INT, N6 INT, N7 INT, N8 INT, N9 INT,";
  $query .= " N10 INT, N11 INT, N12 INT, N13 INT, N14 INT, N15 INT,";
  $query .= " leaguePoints INT, KEY(id) );";
  $db->doQuery ($query);


  // League table
  $query = "CREATE TABLE League (id INT NOT NULL AUTO_INCREMENT, week INT, KEY(id));";
  $db->doQuery ($query);

  $query = "INSERT INTO League (id,week) VALUES ('1','0')";
  $db->doQuery ($query);


  // Modules table
  $query = "CREATE TABLE Modules (id CHAR(20) NOT NULL, name CHAR(30),";
  $query .= " type INT, KEY(id) );";
  $db->doQuery ($query);

  // Insert modules values
  $query = "INSERT INTO Modules (id, name, type) VALUES ('calendar',";
  $query .= " 'Calendario', 1)";
  $db->doQuery ($query);

 $query = "INSERT INTO Modules (id, name, type) VALUES ('change_profile',";
 $query .= " 'Editar perfil', 1)";
 $db->doQuery ($query);

 $query = "INSERT INTO Modules (id, name, type) VALUES ('roster',";
 $query .= " 'Alineacion', 2)";
 $db->doQuery ($query);

 $query = "INSERT INTO Modules (id, name, type) VALUES ('next_week',";
 $query .= " 'Avanzar jornada', 0)";
  $db->doQuery ($query);

  $query = "INSERT INTO Modules (id, name, type) VALUES ('add_user',";
 $query .= " 'Añadir usuario', 0)";
 $db->doQuery ($query);

  $query = "INSERT INTO Modules (id, name, type) VALUES ('reset_league',";
  $query .= " 'Resetear liga', 0)";
  $db->doQuery ($query);

  $query = "INSERT INTO Modules (id, name, type) VALUES ('standings',";
  $query .= " 'Clasificacion', 1)";
  $db->doQuery ($query);

 $query = "INSERT INTO Modules (id, name, type) VALUES ('private_messages',";
 $query .= " 'Mensajes Privados', 1)";
 $db->doQuery ($query);

 $query = "INSERT INTO Modules (id, name, type) VALUES ('manage_users',";
 $query .= " 'Administrar usuarios', 0)";
 $db->doQuery ($query);

 // Private Messages Table
 $query = "CREATE TABLE Messages (id INT NOT NULL AUTO_INCREMENT, messagefrom CHAR(30),";
  $query .= " messageto CHAR(30), subject CHAR(50), body LONGTEXT, internal BIT,  KEY(id) );";
  $db->doQuery ($query);


  echo "Creación completa. Borra el archivo install.php y ya puedes entrar con tu nuevo usuario.";
  echo "¡Disfruta del juego!";
 }
 else
 {
  ?>
 <h1>Instalador de SITE</h1><br><br>
  Introduzca un nombre de usuario y una contraseña para el administrador:<br>
  <form method="POST" action="<?php echo $_SERVER; ?>">
  Nombre de usuario: <input type="text" name="user"><br>
  Contraseña: <input type="password" name="pass"><br><br>
   <input type="submit" value="Enviar" name="send">
 </form>

  <?php

 }
 ?>

任何帮助将不胜感激谢谢

4

1 回答 1

2

你的问题是在线

<form method="POST" action="<?php echo $_SERVER; ?>">

$_SERVER 是一个数组,当您尝试打印它时,您得到的只是“数组”。
据我了解,您正在尝试将表单发布到同一页面,因此您可以删除 action 属性。如果没有,只需提供您想要的 URL 并避免使用 $_SERVER,除非您想以某种方式编辑 URL(例如添加 https 或类似的)

于 2013-02-25T20:52:34.070 回答