I have a php file, which I use to log the user in
- Code: Select all
<?
session_start();
//require_once('polacz.php');
require_once('funkcje.php');
require_once('gui.php');
if($_SERVER['REQUEST_METHOD'] == 'POST'){....
as you see, I fetch 2 files
funkcje.php:
- Code: Select all
<?php
require_once('polacz.php');
function czyIstnieje($u, //uzytkownik - login
$p){ //haslo
$zapytanie = "SELECT login,id FROM logowanie WHERE login='$u' AND haslo='$p'";
$wynik = mysql_query($zapytanie);
if(mysql_num_rows($wynik) == 1)
$odp = mysql_fetch_array($wynik);
if($odp['id']){
//echo $odp['id'];
return ($odp['id']);
}
else{
//echo "blad przy zapytaniu - uzytkownik nie istnieje<br/>";
return -1;
}
};
function zarejstruj($l,$h){
$zapytanie = "INSERT INTO logowanie (login,haslo) VALUES ('$l','$h')";
return( mysql_query($zapytanie));
};
function zaloguj($l,$h){
// szuka cz koles istnieje w bazie danych.
// jesi tak, to zwraca jego id, jesli nie, to -1
//$id = czyIstnieje($l,$h);
$id = 1;
if($id != -1){
return $id;
}
else{
echo "nie moæna Cie zalogować!<br/>podałeś niepoprawne dane";
return -1;
}
};
?>
gui.php:
- Code: Select all
<?php
//session_start();
function pokazRejstracje(){
// dorobic sprawdzanie poprawnosci przy logowaniu!!!!!
echo '<form method="post" action="zarejstruj.php" name="rejstracja">';
echo 'login: <input type="text" name="login"/>';
echo 'hasło: <input type="password" name="haslo"/>';
echo 'powtorz hasło: <input type="password" name="haslo2"/>';
echo 'e-mail: <input type="text" name="email"/>';
echo '<input type="submit" value="OK"/>';
echo '</form>';
};
function pokazLogowanie(){
echo '<form method="post" action="loguj.php" name="logowanie">';
echo 'login: <input type="text" name="login"/><br/>';
echo 'hasło: <input type="password" name="haslo"/>';
echo '<input type="submit" value="OK"/>';
echo '</form>';
};
?>
and the polacz.php:
- Code: Select all
<?php
/* skrypt lazcy sie z baza danych */
mysql_connect(localhost,root,"");
mysql_select_db("dziekanat");
?>
Now, as you see, I do not echo anything out before the "session_start()" function (or do I ?). I get the:
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at F:\software\xampp\htdocs\vd\php\loguj.php:1) in F:\software\xampp\htdocs\vd\php\loguj.php on line 2
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at F:\software\xampp\htdocs\vd\php\loguj.php:1) in F:\software\xampp\htdocs\vd\php\loguj.php on line 2
I really don't know what to do. I read about the ZoneAlarm firewall - I don't use it. I looked through the php variables - nothing. I'm desperate. Can anyone help me ?
I use the XAMPP apache server, it is fresh after install. When I upload those files on another server, it works just as I want...