-1

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?

Broccholio
  • 63
  • 1
  • 7

1 Answers1

0

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.

Brian Kendig
  • 2,452
  • 2
  • 26
  • 36
  • No there are not any whitespace before the opening tag.The files are saved as UTF-8.And they are working on localhost with easyphp but on the server they are just faulty. – Broccholio Apr 14 '14 at 20:31