我做了个登陆界面login.php 结果告诉我Parse error: syntax error, unexpected $end in C:\AppServ\www\Test\login.php on line 166网上我也搜过了 大家各种的解决方法我都一一去看了 可是望穿秋水哦就是没结果 人家都说可能是多了}啊 或者?>啊 让最后真正的结尾变成了unexpected了,可是我看了一遍又一遍 就是没找到 希望大家也帮我看看 是什么问题啊???<?php
if(isset($_GET["error"])){
$title="论坛提示信息";
switch($_GET["error"]){
case"1":
$errormsg="用户名或者密码有误,请重新填写!";
break;
case"2":
$errormsg="游客无权访问此页面";
break;}
}else{
$title="用户登陆";}
?>
<?php require_once('Connections/mybbs.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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['user_name'])) {
$loginUsername=$_POST['user_name'];
$password=$_POST['pwd'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "index.php";
$MM_redirectLoginFailed = "login.php?error=1";
$MM_redirecttoReferrer = true;
mysql_select_db($database_mybbs, $mybbs);
$LoginRS__query=sprintf("SELECT user_name, user_pwd FROM userinfo WHERE user_name=%s AND user_pwd=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $mybbs) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
//declare two session variables and assign them
$_SESSION['MM_user_name'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup; if (isset($_SESSION['PrevUrl']) && true) {
$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">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>>>左脚右脚去旅行>><?php echo $title;?></title>
<link href="style/style.css" rel="stylesheet" type="text/css" />
</head>
<style type="text/css">
<!--
.STYLE8 {font-weight: bold}
.STYLE9 {
font-size: 18px;
font-weight: bold;
color: #FFFFFF;
font-family: "楷体_GB2312";
}
-->
</style>
<?php include( "title.php" ); ?>
<style type="text/css">
<!--
.STYLE7 {
font-size: 18px;
color: #FFFFFF;
font-weight: bold;
font-family: "楷体_GB2312";
}
.STYLE8 {
font-size: 16px;
font-weight: bold;
}
-->
</style><script language="javascript">
function checkFormData(){
if(login.user_name.value==""){
alert("请输入用户名!");
login.user_name.focus();
return false;
}
if(login.pwd.value==""){
alert("请输入密码!");
login.pwd.focus();
return false;}
}
</script>
<table width="100%" border="0">
<tr>
<td nowrap="nowrap"><p>>>当前位置:<strong>用户登录</strong></p></td>
</tr>
</table>
<?php if(isset ($_GET["error"])){?>
<table width="49%" border="1" align="center">
<tr>
<td bgcolor="#CC0000"><div align="center"><span class="STYLE9">论坛提示信息</span> </div></td>
</tr>
<tr>
<td><?php echo$errormsg;?></td>
</tr>
</table><?php {?><form action="<?php echo $loginFormAction; ?>" name="login" method="POST" onsubmit="return checkFormData();">
<table width="35%" border="1" align="left">
<tr nowrap="nowrap"><td height="30" colspan="2" bgcolor="#CC0000"><div align="center"><span class="STYLE9">登录到论坛</span></div></td></tr>
<tr nowrap="nowrap">
<td width="19%" height="31"><span class="STYLE8">用户名:</span></td>
<td width="81%"><input name="user_name" type="text" id="user_name" width="50" /></td>
</tr>
<tr nowrap="nowrap">
<td width="19%" height="35"><span class="STYLE8">密码:</span></td>
<td width="81%"><input type="password" name="pwd" id="pwd" width="50" /></td>
</tr>
<tr nowrap="nowrap">
<td> </td>
<td><input type="button" name="submit" value="确定" onclick="location.href='index.php'" /></td></tr>
</table></form>
</body>
</html>
<?php include"regend.php"?>
if(isset($_GET["error"])){
$title="论坛提示信息";
switch($_GET["error"]){
case"1":
$errormsg="用户名或者密码有误,请重新填写!";
break;
case"2":
$errormsg="游客无权访问此页面";
break;}
}else{
$title="用户登陆";}
?>
<?php require_once('Connections/mybbs.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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['user_name'])) {
$loginUsername=$_POST['user_name'];
$password=$_POST['pwd'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "index.php";
$MM_redirectLoginFailed = "login.php?error=1";
$MM_redirecttoReferrer = true;
mysql_select_db($database_mybbs, $mybbs);
$LoginRS__query=sprintf("SELECT user_name, user_pwd FROM userinfo WHERE user_name=%s AND user_pwd=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $mybbs) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
//declare two session variables and assign them
$_SESSION['MM_user_name'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup; if (isset($_SESSION['PrevUrl']) && true) {
$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">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>>>左脚右脚去旅行>><?php echo $title;?></title>
<link href="style/style.css" rel="stylesheet" type="text/css" />
</head>
<style type="text/css">
<!--
.STYLE8 {font-weight: bold}
.STYLE9 {
font-size: 18px;
font-weight: bold;
color: #FFFFFF;
font-family: "楷体_GB2312";
}
-->
</style>
<?php include( "title.php" ); ?>
<style type="text/css">
<!--
.STYLE7 {
font-size: 18px;
color: #FFFFFF;
font-weight: bold;
font-family: "楷体_GB2312";
}
.STYLE8 {
font-size: 16px;
font-weight: bold;
}
-->
</style><script language="javascript">
function checkFormData(){
if(login.user_name.value==""){
alert("请输入用户名!");
login.user_name.focus();
return false;
}
if(login.pwd.value==""){
alert("请输入密码!");
login.pwd.focus();
return false;}
}
</script>
<table width="100%" border="0">
<tr>
<td nowrap="nowrap"><p>>>当前位置:<strong>用户登录</strong></p></td>
</tr>
</table>
<?php if(isset ($_GET["error"])){?>
<table width="49%" border="1" align="center">
<tr>
<td bgcolor="#CC0000"><div align="center"><span class="STYLE9">论坛提示信息</span> </div></td>
</tr>
<tr>
<td><?php echo$errormsg;?></td>
</tr>
</table><?php {?><form action="<?php echo $loginFormAction; ?>" name="login" method="POST" onsubmit="return checkFormData();">
<table width="35%" border="1" align="left">
<tr nowrap="nowrap"><td height="30" colspan="2" bgcolor="#CC0000"><div align="center"><span class="STYLE9">登录到论坛</span></div></td></tr>
<tr nowrap="nowrap">
<td width="19%" height="31"><span class="STYLE8">用户名:</span></td>
<td width="81%"><input name="user_name" type="text" id="user_name" width="50" /></td>
</tr>
<tr nowrap="nowrap">
<td width="19%" height="35"><span class="STYLE8">密码:</span></td>
<td width="81%"><input type="password" name="pwd" id="pwd" width="50" /></td>
</tr>
<tr nowrap="nowrap">
<td> </td>
<td><input type="button" name="submit" value="确定" onclick="location.href='index.php'" /></td></tr>
</table></form>
</body>
</html>
<?php include"regend.php"?>
</table> <?php {?>
的“{”改成“}”,
与上边的
<?php if(isset ($_GET["error"])){?>
的“{”
对应。改后貌似运行正常哈。