我重視我的代碼,我使用了PHP中一個非常基本的登錄。它給了一個錯誤
無法發送會話cookie - 標題 已經發出(輸出開始 C:\ XAMPP \ htdocs中\ netsentries \˚F\包括\的functions.php:1)
<?php
if (!isset($_POST['username'])) {
?>
<h3>Login</h3>
<form action="" method="post">
Username<br/>
<input name="username" type="text" /><br/>
Password<br/>
<input name="password" type="password" /><br/>
<input name="" type="submit" /><br/>
</form>
<?php
}
else
{
include('includes/config.php');
$data['username']= $_POST['username'];
$data['password']= md5($_POST['password']);
connect($db_name,$db_user,$db_pass,$db_host);
$query= "select * from user where username='" . $data['username'] . "' AND password='" . $data['password'] . "'";
$result=mysql_query($query);
//check that at least one row was returned
$rowCheck = mysql_num_rows($result);
if($rowCheck > 0)
{
while($row = mysql_fetch_array($result))
{
session_start();
session_register($data['username']);
//successful login code will go here...
//echo 'Logged in!';
}
}
else
{
echo "Failed!";
}
}
?>
難道不能找出問題
該錯誤是從文件C來:\ XAMPP \ htdocs中\ netsentries \˚F\包括\ functions.php:1。你確定你沒有調用該文件中的header()函數嗎? –
include('includes/config.php');'? – Neal
檢查C:\ xampp \ htdocs \ netsentries \ f \ includes \ functions.php是否輸出任何內容。 – webspy