-1

出现错误:解析错误:语法错误,第 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;

}
?>
4

1 回答 1

6

你忘了一个;

echo "Please enter correct Password";
header("location:login.html");
session_start();
$_SESSION['login'] = ''    // <----here
exit();

这不可能在昨天工作,所以有些东西改变了这个脚本......

于 2013-04-16T16:19:20.060 回答