错误的效果是:Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /drive2/fpgshttpd/bestmore/test/check.php:2) in /drive2/fpgshttpd/bestmore/test/check.php on line 5Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /drive2/fpgshttpd/bestmore/test/check.php:2) in /drive2/fpgshttpd/bestmore/test/check.php on line 5Warning: Cannot modify header information - headers already sent by (output started at /drive2/fpgshttpd/bestmore/test/check.php:2) in /drive2/fpgshttpd/bestmore/test/check.php on line 45正确的效果是:sessiontestsessionpage1 page2 jmp sessionidee9e688d78b1bce28c3cf72490cdac44
url后面附件什么东西,总是说我登陆没有成功呀。而且我重新启动了APACHE呀。帮助我看看这是什么错误?
http://www.freepgs.com/bestmore/test/
其中user = test,pwb = test
session_start();
$session = "sessiontest";
$user = $_POST["user"];
$password = $_POST["password"];
if ( "test" == $password and "test" == $user)
{
$_SESSION["session"] = "sessiontest";
session_register('session');
header("Location: ./jmp.php");
}
else
{
header("Location: ./index.html");
} ?> jmp.php代码如下
<?php
session_start();
if (isset($_SESSION['session']))
$aa = $_SESSION['session'];
else
$aa = "";
echo $_SESSION['session']."session";
if("sessiontest" == $aa)
{
$id = session_id();
echo "<a href = 't1.php'>page1</a><br>";
echo "<a href = 't2.php'>page2</a><br>";
echo "<a href = 'jmp.php'>jmp</a><br>";
echo "sessionid".$id;
}
else
{
phpinfo();
}?>
page2
jmp
sessionidee9e688d78b1bce28c3cf72490cdac44
前面是不是有HTML代码?
session_start()前面不能有任何输出
$_SESSION["session"] = "sessiontest";
session_register('session');
这表明多次注册session,出现警告。<?
session_start();
这个有空行,删除即可。但是为什么我在本地机器上就没问题呢,(win 2000)。现在这个贴只差问题3没解决了:就是我在windows下让session.use_trans_sid = 1,禁止COOKIE,死活没能够通过验证!也就是我必须使用cookie来保存sessionid.
if ( "test" == $password and "test" == $user)
{
session_register('session');
if(empty($_COOKIE[PHPSESSID]))
header("Location: ./jmp.php?PHPSESSID=".session_id());
else
header("Location: ./jmp.php");
exit;
}
else
{
header("Location: ./index.html");
}