2009-12-30 63 views
0

我得到一个内部服务器错误与下面的代码...任何建议:内部服务器错误命令

<form name="user" action="this.php" method="post"> 
<input type="text" name="description" id="description" value="" /> 

<input type="submit" name="" id="" value="Edit Page" />  
</form> 

还有就是页面上没有其他代码,并自提交罚款,除非我把文本字段中的一个MySQL查询,如SELECT查询FROM d,其中1 = 1

然后我得到以下错误:

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

我确实有一些的.htaccess规则怎么回事,但我不知道怎么会影响一个查询,并不做任何事情或去任何地方......

+0

如何MySQL的声明得到放入PHP页面? – wallyk 2009-12-30 23:16:32

+0

如果我在输入框中输入SQL语句。我认为这是一个服务器配置问题,但我不知道从哪里开始寻找。 – kylex 2009-12-30 23:20:27

+0

无关(或只有轻微相关,如果mod_security的猜测是正确的,因为我怀疑),但你需要'htmlspecialchars'你'PHP_SELF',和你一样写入HTML其他任何字符串的呼应。否则,你的风险破损和跨站点脚本错误(即使恼人的和无效的mod_security已开启)。 – bobince 2009-12-31 01:10:53

回答

3

似乎是邪恶的mod_security 规则。你在共享主机?一般来说,你可以通过的.htaccess文件禁用所有模块或特定的规则。

+0

你说得对,这是一个mod_security问题。只需将受影响的文件列入白名单。 – kylex 2009-12-31 15:05:14

0

看是你的web服务器的日志文件的第一个地方。

第二个地方是How can I prevent SQL injection in PHP?,因为我猜你只是把用户把你手中的东西塞进SQL服务器而没有任何消毒。

+0

我没有提交任何东西到SQL服务器。这是奇怪的部分。在脚本中甚至没有连接到SQL服务器。 – kylex 2009-12-31 05:53:54

-1

由于提供的信息有限,这听起来像就是你以某种方式发送一个畸形SQL查询,你不要再追MySQL服务器返回的错误。你需要看看你发送了什么,并处理mysql错误。

+0

什么都不是SQL服务器......至少不通过脚本。我展示的代码是所有正在发送的代码。脚本中没有其他的东西存在。 – kylex 2009-12-31 05:49:08

0

之前执行,倾倒的$ _ POST []的内容;

var_dump($_POST); 

在发展enviorment,这是很好的使错误显示:

display_errors(1); 

或者在php.ini:

display_errors = On;