Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Logowanie, Sesje
Forum PHP.pl > Forum > Przedszkole
Mlodycompany
Witam. Mam logowanie i mi nie działa smile.gif. Wyskakuje na stronie błąd: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\usr\www\townoflaugh\index.php:20) in C:\usr\www\strona\log.php on line 2

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\usr\www\townoflaugh\index.php:20) in C:\usr\www\strona\log.php on line 2

Kod Strony:
  1. <?php
  2.  
  3. function checkPass($user, $pass)
  4. {
  5. if(!$fd = @fopen("/secure/passwords.txt", "r")) return false;
  6. $result = false;
  7. while (!feof ($fd)){
  8. $line = trim(fgets($fd));
  9. $arr = explode(":", $line);
  10. if(count($arr) < 2) continue;
  11.  
  12. if($arr[0] != $user) continue;
  13.  
  14. if($arr[1] == $pass){
  15. $result = true;
  16. break;
  17. }
  18. }
  19. fclose($fd);
  20. return $result;
  21. }
  22.  
  23. if(isSet($_SESSION['zalogowany'])){
  24. header("Location: glowna.php");
  25. exit();
  26. }
  27. else if(isSet($_POST['user']) && isSet($_POST['haslo'])){
  28. if(checkPass($_POST['user'], $_POST['haslo'])){
  29. $_SESSION['zalogowany'] = true;
  30. header("Location: glowna.php");
  31. exit();
  32. }
  33. }
  34. ?>

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <meta http-equiv="Content-type" content="text/html; charset=iso-8859-2">
  3. <title>Town Of Laugh :: Najśmieszniejszy Portal Rozrywkowy :: Logowanie</title>
  4. </head>
  5. <div align='left'>
  6. <form name = "formularz1"
  7. action = "glowna.php"
  8. method = "POST"
  9. >
  10. <table border="0">
  11. <tr>
  12. <td colspan="2" align="center">
  13. Podaj nazwę i hasło
  14. </td>
  15. </tr><tr>
  16. <td>Użytkownik:</td>
  17. <td>
  18. <input type="text" name="user">
  19. </td>
  20. </tr><tr>
  21. <td>Hasło:</td>
  22. <td>
  23. <input type="password" name="haslo">
  24. </td>
  25. </tr><tr>
  26. <td colspan="2" align="center">
  27. <input type="submit" value="Wejdź">
  28. </td>
  29. </tr></table>
  30. </form>
  31. </div>
  32. </body>
  33. </html>


Czy może mi ktoś z łaski swojej pomóc??
nospor
Temat walkowany tyle razy... Uzyj wyszukiwarki forum. Szukaj pod haslem:
headers already sent

zamykam
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.