Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Closed TopicStart new topic
> [PHP] Cannot send session cookie
o2w5n778
post
Post #1





Grupa: Zarejestrowani
Postów: 235
Pomógł: 0
Dołączył: 10.12.2009

Ostrzeżenie: (0%)
-----


Witam!
Mam problem ze skryptem logowania. Zwraca mi 2 errory:
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/derek/public_html/index.php:9) in /home/derek/public_html/login.php on line 10

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/derek/public_html/index.php:9) in /home/derek/public_html/login.php on line 10
  1. <?php
  2.  
  3. $mysql = mysql_connect('*****','****','****') or die (mysql_error());
  4. $mysql = mysql_select_db('****') or die (mysql_error());
  5.  
  6. include('config.php');
  7.  
  8. $nick = $_POST['nick'];
  9. $haslo = $_POST['haslo'];
  10. $haslo = md5($haslo);
  11.  
  12. $query = mysql_query("SELECT * FROM users WHERE nick='$nick' AND haslo='$haslo' AND status='1'");
  13. $show = mysql_fetch_assoc($query);
  14.  
  15. if (mysql_num_rows($query) == 1){
  16. $_SESSION['zalogowany'] = 1;
  17. }
  18.  
  19. if(!isset($_SESSION['zalogowany'])){
  20. print('<form method="post" action="">');
  21. print('Nick: <input type="text" name="nick"><br>');
  22. print('Hasło: <input type="password" name="haslo"><br>');
  23. print('<input type="submit" value="Zaloguj"><br>');
  24. print('<a href="register.php"> Rejestracja</a> <a href="forget_password.php">Zapomniałem hasła</a>');
  25. print('</form>');
  26. }
  27.  
  28. if(isset($_SESSION['zalogowany'])){
  29. print('<b>Witaj '.$show['nick'].'</b><br>');
  30. print('<a href="index.php?id=edytuj_profil">Edytuj profil</a><br>');
  31. if($show['ranga'] == 'admin'){
  32. print('<a href="index.php?id=panel_administratora">Panel administratora</a><br>');
  33. }
  34. print('<a href="index.php?id=wyloguj">Wyloguj</a><br>');
  35. }
  36.  
  37. ?>


Dodawanie ob_start() i ob_edn_flush() nie pamaga

Ten post edytował o2w5n778 4.08.2011, 17:53:38


--------------------
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




Problem poruszany milion razy i zawsze jest ten sam zestaw rozwiązań.
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 - 14:58