Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php]header
Mike122
post
Post #1





Grupa: Zarejestrowani
Postów: 253
Pomógł: 1
Dołączył: 12.04.2006

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


Witam posiadam pewien problem w php i nie mogę sobie z nim poradzić. Proszę mnie nie odsyłać do
manuala bo czytałem już http://pl.php.net/header i nic robie tak jak tam jest pokazane choć próbowałem też innych metod.
Błąd:
Warning: Cannot modify header information - headers already sent by (output started at /httpd/mycms/logowanie.php:1) in /httpd/mycms/logowanie.php on line 2
Kod wygląda następująco:
  1. <?php
  2. header("Location: index.php");
  3. ini_set( 'session.use_cookies', 1 );
  4. include ("syscms/function.inc.php");
  5. //MySQL
  6. $db_hots = "*******";
  7. $db_root = "*******";
  8. $db_pass = "*******";
  9. $db_name = "*******";
  10. db_connect ($db_hots, $db_root, $db_pass, $db_name);
  11.  
  12. if( !empty( $_POST['login'] ) && $_POST['haslo'] )
  13. {
  14. //us
  15. $query = mysql_query("SELECT * FROM users WHERE ksywa = '{$_POST['login']}'");
  16.  if (mysql_num_rows($query) < 1) {
  17. print "Brak loginu ".$_POST['login']." w bazie";
  18.  }else{
  19.  $querypass = mysql_query("SELECT * FROM users WHERE ksywa = '{$_POST['login']}' and pass = '{$_POST['haslo']}'");
  20. if (mysql_num_rows($querypass) < 1) {
  21. print "Nie poprawne hasło";
  22. }else{
  23. $rekord = mysql_fetch_assoc ($querypass);
  24. $_SESSION['user'] = $rekord['ksywa'];
  25. $_SESSION['status'] = $rekord['statususer'];
  26. print "<a href="".$_POST['from']."">Zostałeś zalogowany.</a>n";
  27. }
  28.  }
  29.  
  30. }
  31. elseif( $_GET['def'] == 'logout' )
  32. {
  33. session_destroy(); // zniszczenie sesji = wylogowanie
  34. print "<a href="".$_SERVER['HTTP_REFERER']."">Zostałeś wylogowany.</a>n";
  35. }
  36. else
  37. {
  38. print "<a href="".$_SERVER['HTTP_REFERER']."">Zostałeś wylogowany.</a>n";
  39. }
  40. ?>

Próbowałem też:
  1. <?php
  2. header("Location: index.php");
  3. ?>

  1. <?php
  2. header("Location: index.php");
  3. ?>

Proszę o pomoc.

Ten post edytował Mike122 2.01.2007, 21:45:22
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 3.10.2025 - 00:41