Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php]Logowanie, Probelm
Kamils2
post 18.11.2006, 12:37:06
Post #1





Grupa: Zarejestrowani
Postów: 158
Pomógł: 0
Dołączył: 13.09.2006
Skąd: Puławy

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


witam mam problem mam pliczek index.php (index.php?cmd=zaloguj)

i podaje poprawny login i haslo wczesniej zalozylem konto klikam zaloguj i wywala mi blad

  1. <?php
  2. Warning: Cannot modify header information - headers already sent by (output started at C:Program FilesWebServhttpdindex.php:6) in C:Program FilesWebServhttpdindex.php on line 212
  3. ?>


noi nie wiem co tu moze byc zle :/

linia 212 - index.php :
  1. <?php
  2. header("location: index.php");
  3. ?>


no i oczywiscie caly kod cmd=zaloguj

  1. <?php
  2. if ($_GET['cmd'] == 'zaloguj') {
  3. $ha = md5($ha);
  4. $polacz = mysql_connect("$host", "$user", "$haslo");
  5. mysql_select_db("$baza");
  6. $wynik=mysql_query("SELECT * FROM users WHERE lo='$lo' AND ha='$ha'");
  7. if($wynik){
  8.  while($rek = mysql_fetch_array($wynik)){
  9. $_SESSION["zalogowany"]="tak";
  10. $_SESSION["lo"]=$rek["lo"];
  11. $_SESSION["em"]=$rek["em"];
  12. $_SESSION["gg"]=$rek["gg"];
  13. $_SESSION["st"]=$rek["st"];
  14. header("location: index.php");
  15.  }
  16. }
  17. if($wynik>0){
  18.  echo "<br /><br /><div style='text-align:center;font:bold 13px Arial;'>Błędny Login lub Hasło!<br />
  19.  <a href='$HTTP_REFERER'>&laquo;&nbsp;wróć</a></div>";
  20. }
  21. }
  22. ?>


prose o pomoc - jak zawsze smile.gif
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
Cysiaczek
post 18.11.2006, 12:48:33
Post #2





Grupa: Moderatorzy
Postów: 4 465
Pomógł: 137
Dołączył: 26.03.2004
Skąd: Gorzów Wlkp.




Tak jak jest napisane - nagłówki zostały wysłane. W praktyce oznacza to, ze gdzieś ptrzed wywołanie header() kazałeś coś wysłać do przeglądarki.

http://pl2.php.net/manual/pl/function.header.php

Pozdrawiam.


--------------------
To think for yourself you must question authority and
learn how to put yourself in a state of vulnerable, open-mindedness;
chaotic, confused, vulnerability, to inform yourself.
Think for yourself. Question authority.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 06:10