获取错误:解析错误:语法错误,第47行的C:\ wamp \ www \ login.php中出现意外的T_EXIT。需要一些帮助。它昨天工作了
<?php
require_once("config.php");
$email=$_POST['email'];
$password=$_POST['password'];
$email = stripslashes($email);
$password = stripslashes($password);
$email = mysql_real_escape_string(strip_tags($email));
$password = mysql_real_escape_string(strip_tags($password));
// Check occurence of email password combination
$sql="SELECT * FROM register WHERE email='$email'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $email, table row must be 1 row
if($count==1)
{
$row = mysql_fetch_array($result);
if($password == $row['password'])
{
session_start();
$_SESSION['login'] = "1";
header("location:home.html");
exit;
}
else
{
echo "Please enter correct Password";
header("location:login.html");
session_start();
$_SESSION['login'] = ''
exit();
}
}
else
{
header("Location:register.html");
exit();
}
?>
还将以下代码段添加到home.php,但无法使用登录会话
<?php
session_start();
require_once("config.php");
if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) {
header ("Location: login.html");
exit;
}
?>
答案 0 :(得分:4)
您忘记了;
:
echo "Please enter correct Password";
header("location:login.html");
session_start();
$_SESSION['login'] = '' // <----here
exit();
昨天这可能不会有效,所以有些东西改变了这个剧本......