IIS7+PHP+mysql建立网站后台管理登录页面显示网站内部服务器错误 500

zengwensi 2012-04-25 11:36:11
代码如下:
由DW cs5 生成的代码
<?php virtual('/Connections/conn.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['u'])) {
$loginUsername=$_POST['u'];
$password=$_POST['p'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "index.php";
$MM_redirectLoginFailed = "error.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_conn, $conn);

$LoginRS__query=sprintf("SELECT admin_name, admin_pass FROM `admin` WHERE admin_name=%s AND admin_pass=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));

$LoginRS = mysql_query($LoginRS__query, $conn) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";

if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;

if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
session_start();
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<dl>
<dt>欢迎进入后台管理页面</dt><br />

<dd>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><form action="" method="POST"><table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="52" align="right">用户名</td>
<td width="248"><label for="u"></label>
<input type="text" name="u" id="u" /></td>
</tr>
<tr>
<td align="right">密码</td>
<td><label for="p"></label>
<input type="password" name="p" id="p" /></td>
</tr>
<tr>
<td align="right"> </td>
<td><input type="submit" name="button" id="button" value="登录" /></td>
</tr>
</table>

</form></td>
</tr>
</table>
</dd>
</dl>
</body>
</html>
...全文
303 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
coder 2012-04-26
  • 打赏
  • 举报
回复
virtual 改成include
zengwensi 2012-04-25
  • 打赏
  • 举报
回复
在IE的设置中调试过显示每个脚本错误和友好错误。但是调试完网页成了一块白板。mysql重新配置了几遍,还是一样,我想应该是CS5生成的代码错误。求PHP高手帮个忙,万分感谢!

20,359

社区成员

发帖
与我相关
我的任务
社区描述
“超文本预处理器”,是在服务器端执行的脚本语言,尤其适用于Web开发并可嵌入HTML中。PHP语法利用了C、Java和Perl,该语言的主要目标是允许web开发人员快速编写动态网页。
phpphpstorm 技术论坛(原bbs)
社区管理员
  • 开源资源社区
  • phpstory
  • xuzuning
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧