我已经通过网络搜索了很多,但没有一个解决方案解决了我的问题..我仍然收到这个错误
警告:session_start()[function.session-start]:无法发送会话cookie - 标头已经发送(输出从
这里开始是我的代码
<?php
ob_start();
session_start();
$myusername = $_POST['username'];
$mypassword = $_POST['password'];
$myusername = stripslashes( $myusername );
$mypassword = stripslashes( $mypassword );
$myusername = mysql_real_escape_string( $myusername );
$mypassword = mysql_real_escape_string( $mypassword );
$mypassword = md5( $mypassword );
$con = mysql_connect("localhost", "root", "");
if( !$con ) {
die('Error connecting to server :'.mysql_error());
}
mysql_select_db("user_login",$con);
$result = mysql_query("SELECT username, password FROM user_info WHERE username='$myusername' && password='$mypassword'");
if( !mysql_fetch_array( $result, MYSQL_ASSOC ) ) {
//echo "<b><p>Wrong username or password.</p></b>";
//echo "<br /><a href='http://localhost/simic/option.php?page=login'>
Go back to login page </a>";
header('Location: option.php?page=attempt_to_login');
} else {
$_SESSION['access'] = 1;
$_SESSION['user'] = $_POST[username];
header('Location: option.php?page=online');
}
mysql_close( $con );
ob_flush();
?>
那么我该如何解决这个问题???有什么帮助吗?