Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Closed TopicStart new topic
> Logowanie, Sesje
Mlodycompany
post
Post #1





Grupa: Zarejestrowani
Postów: 910
Pomógł: 44
Dołączył: 20.02.2008
Skąd: Łódź

Ostrzeżenie: (20%)
X----


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??
Go to the top of the page
+Quote Post
nospor
post
Post #2





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




Temat walkowany tyle razy... Uzyj wyszukiwarki forum. Szukaj pod haslem:
headers already sent

zamykam


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post

Closed TopicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 19.08.2025 - 07:20