请教问题出在哪
<?php
/*
* Created on 2012-5-30
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
include("coon.php");
if($_GET[out]){
setcookie("cookie","out");
echo "<script type=\"text/javascript \">location.href='login.php';</script>";
}
if($_POST[user]=='admin'){
$pw=md5($_POST[pw]);
if($pw=='e1bfd762321e409cee4ac0b6e841963c'){
setcookie('cookie','ok');
echo "<script type=\"text/javascript \">location.href='login.php';</script>";
}
include("head.php");
if($_COOKIE['cookie']!='ok'){
?>
<script type="text/javascript">
function Check(){
if(myform.user.value==""){
alert("请填写用户名");
myform.user.foucs();
return false;
}
if(myform.pw.value==""){
alert("请填写密码");
myform.pw.focus();
return false;
}
</script>
<form action="" method="post" name="myform" onsubmit="return Check()">
ID: <input type="text" name="user" />
PW: <input type="password" name="pw" />
<input type="submit" name="submit" value="登陆"/>
</form>
<?php
}else{
?>
<a href='?out=login.php'>退出</a>
<?php
}
?>
Parse error: syntax error, unexpected $end in D:\wamp\www\bbs\login.php on line 56
[解决办法]
总共才 48 行代码,拿来 56 行出错?
[解决办法]
错误比较明确啊,$end这个变量有问题啊,先查一下,这个变量在哪里出现了啊,估计要查一下coon.php
[解决办法]
if($_GET[out]){
$_GET['OUT']'去掉可以不?
[解决办法]
不解释了,把我的代码拷贝下吧,括号匹配不合适。
<?php
/*
* Created on 2012-5-30
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
include("coon.php");
if($_GET[out]){
setcookie("cookie","out");
echo "<script type=\"text/javascript \">location.href='login.php';</script>";
}
if($_POST[user]=='admin'){
$pw=md5($_POST[pw]);
if($pw=='e1bfd762321e409cee4ac0b6e841963c'){
setcookie('cookie','ok');
echo "<script type=\"text/javascript \">location.href='login.php';</script>";
} }
include("head.php");
if($_COOKIE['cookie']!='ok'){
?>
<form action="" method="post" name="myform" onsubmit="return Check()">
ID: <input type="text" name="user" />
PW: <input type="password" name="pw" />
<input type="submit" name="submit" value="登陆"/>
</form>
<?php
}else{
?>
<a href='?out=login.php'>退出</a>
<?php
}
?>
<script language="javascript">
function Check(){
if(myform.user.value==""){
alert("请填写用户名");
myform.user.foucs();
return false;
}
if(myform.pw.value==""){
alert("请填写密码");
myform.pw.focus();
return false;
} }
</script>