Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\strona\log.php:1) in C:\xampp\htdocs\strona\log.php on line 0
Próbowałem, jak to było proponowane w wielu odpowiedziach dodać ob_start() na początku i ob_end_flush() na końcu- to nic nie pomogło. Dodam, że kodowanie UTF-8 i w opcjach programu jest odznaczona opcja do dodania "BOM".
Edytowałem plik php.ini i tam w jednym miejscu zmieniałem z off na on.
Gdy na początku pliku dodałem session_start() odziwo uruchomiło się bez błędów, ale gdy wprowadze błędne dane do logowania pojawia się coś takiego
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\strona\log.php:2) in C:\xampp\htdocs\strona\log.php on line 74
a gdy dane są poprawne to coś takiego, czy wnioskuje że połączenia z bazą jest poprawne tylko coś innego psuje
Warning: session_regenerate_id() [function.session-regenerate-id]: Cannot regenerate session id - headers already sent in C:\xampp\htdocs\strona\log.php on line 63
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\strona\log.php:2) in C:\xampp\htdocs\strona\log.php on line 71
Sprawdziłem jeszcze dla pewności, czy na początku nie ma jakiś krzaczków za pomocą programu pspad i było ok
Mam kod, w którym jest prosty formularz do wprowadzania loginu i hasła no i oczywiscie baze użytkowników.
Oto kod:
<?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": break; case "double": break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } ?> <?php // *** Validate request to login to this site. } $loginFormAction = $_SERVER['PHP_SELF']; $_SESSION['PrevUrl'] = $_GET['accesscheck']; } $loginUsername=$_POST['login']; $password=$_POST['haslo']; $MM_fldUserAuthorization = ""; $MM_redirectLoginSuccess = "/strona/index.html"; $MM_redirectLoginFailed = "/strona/log.php"; $MM_redirecttoReferrer = false; GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); if ($loginFoundUser) { $loginStrGroup = ""; //declare two session variables and assign them $_SESSION['MM_Username'] = $loginUsername; $_SESSION['MM_UserGroup'] = $loginStrGroup; $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; } } else { } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Dokument bez tytułu</title> </head> <body> <label for="login">login</label> <input type="text" name="login" id="login" /> <label for="haslo">haslo</label> <input type="password" name="haslo" id="haslo" /> <input type="submit" name="wyslij" id="wyslij" value="Wyślij" /> </form> </body> </html>