IIS7+PHP+mysql建立网站后台管理登录页面显示网站内部服务器错误 500
代码如下:
由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>
由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>
...全文
相关推荐
IIS+PHP+MySQL环境中PHP.INI需要注意的几个地方
本文主要介绍了在IIS+PHP+MySQL环境下配置PHP.INI文件时需要注意的关键设置,以确保环境的稳定性和性能。在构建IIS(Internet Information Services)与
HTTP 错误 500.19 – Internal Server Error解决办法详解
HTTP 错误 500.19 – Internal Server Error 是一种常见的Web服务器错误,它表明服务器在尝试处理请求时遇到了内部配置问题,导致无法正常服务。
FastCGI Error Number: 5 (0x80070005)解决方法
在这种情况下,错误发生在FastCGI处理器尝试处理请求时,导致HTTP 500 - 服务器错误。
骏飞订单尾号夺宝
7. `奇偶猫.txt`:这个名字看起来像是一个内部文档或者笔记,可能包含了关于系统某些特定功能的解释,例如可能涉及到的随机算法或者某种规则。8.
sql注入天书
根据国情,国内的网站用ASP+Access或SQL Server的占70%以上,PHP+MySQL占20%,其他的不足10%。在本文中,我们将从分入门、进阶至高级讲解一下ASP注入的方法及技巧。


