dongqindan4406 2014-04-14 20:22
浏览 57

无法发送会话cookie警告,只是无法弄清楚是什么导致它

So i'm trying to make a little admin page for my site to manage this and that,but its always giving me warnings like:

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/phisiomins/web/rendszergazda/index.php:1) in /home/phisiomins/web/rendszergazda/index.php on line 2

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/phisiomins/web/rendszergazda/index.php:1) in /home/phisiomins/web/rendszergazda/index.php on line 2

and when i try to log into then it gives 3:

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/phisiomins/web/rendszergazda/belepellenor.php:1) in /home/phisiomins/web/rendszergazda/belepellenor.php on line 2

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/phisiomins/web/rendszergazda/belepellenor.php:1) in /home/phisiomins/web/rendszergazda/belepellenor.php on line 2

Warning: Cannot modify header information - headers already sent by (output started at /home/phisiomins/web/rendszergazda/belepellenor.php:1) in /home/phisiomins/web/rendszergazda/belepellenor.php on line 9

so here is the 2 php im talkin about,i'Ve read about this warning but can't find the mistake,the index.php:

<?php
session_start();
include "../connect.php";
if(!isset($_SESSION["admin"]))
{
?>
<div>
<form action="belepellenor.php" method="post">
Felhasználónév:<br><input type="text" name="felhasznalonev"><br>
Jelszó:<br><input type="password" name="jelszo"><br>
<input type="submit" value="Belépés">
</form>
<div>
<?php
}
else include "adminfelulet.php";
?>

and the belepellenor.php:

<?php
session_start();
include("../kapcsolat.php");
$vissza=mysqli_query($db, "select * from felhasznalok where  felhasznalonev='".$_POST["felhasznalonev"]."' and jelszo='".$_POST["jelszo"]."'");
$sorok_szama=mysqli_num_rows($vissza);
if($sorok_szama>0)
{
$_SESSION["admin"]=$_POST["felhasznalonev"];
header("Location:index.php");
}
else print "Hibás felhasználónév vagy jelszó!<br><a      href='http://www.testfogyasztas.net/rendszergazda/index.php'>Vissza</a>";
?>

any ideas?

  • 写回答

1条回答 默认 最新

  • douyou1960 2014-04-14 20:28
    关注

    By the time your server is directed to send HTTP headers, it has already begun to generate the page; thus the error. Is there any whitespace before the <?php opening tag? If the file is saved as anything other than vanilla ASCII, it's possible that it has Unicode Byte Order Mark (BOM) characters at the very start of the file but that your editor is hiding them from you.

    评论

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测