Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [php] Header location problem
bigart
post 3.11.2009, 18:45:30
Post #1





Grupa: Zarejestrowani
Postów: 68
Pomógł: 0
Dołączył: 20.10.2006

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


Witam,
mam problem z przekierowanie przez header("Location : ");
napisałem sobie prosty kod:
  1. <?php
  2. if (isset($_POST['logowanie']))
  3. {
  4. if (($_POST["login"]=='user')&&($_POST["haslo"]=='user1'))
  5. {
  6. $_SESSION["user"]=$_POST["login"];
  7. //echo $_SESSION["user"];
  8. header("Location : index.php");
  9. //exit;
  10. }
  11. else
  12. {
  13. header("Location : blad.php");
  14. exit;
  15. }
  16. }
  17.  
  18. if (!$_SESSION["user"])
  19. {
  20.  
  21.  
  22. echo "<form action='login.php' method='POST'>";
  23. echo "<input type='text' name='login'>";
  24. echo "<input type='password' name='haslo'>";
  25. echo "<input type='submit' name='logowanie' value='Zaloguj'>";
  26. echo "</form>";
  27. }
  28. else
  29. {
  30. header("Location : index.php");
  31. //exit;
  32. }
  33. ?>

i niestety przy poprawnym logowaniu nie przekierowuje?
możecie jakoś pomóc? może coś w ustawieniach php mam źle ?
Go to the top of the page
+Quote Post
Nattfarinn
post 3.11.2009, 19:10:13
Post #2





Grupa: Zarejestrowani
Postów: 136
Pomógł: 22
Dołączył: 19.09.2007
Skąd: Sosnowiec

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


Usuń spację pomiędzy dwukropkiem a wyrazem Location. Poprawny nagłówek wygląda:
  1. header("Location: xxxx");


Ten post edytował Nattfarinn 3.11.2009, 19:10:27


--------------------
Code should run as fast as necessary, but no faster; something important is always traded away to increase speed.
-- R. Pattis
Go to the top of the page
+Quote Post
bigart
post 3.11.2009, 19:19:32
Post #3





Grupa: Zarejestrowani
Postów: 68
Pomógł: 0
Dołączył: 20.10.2006

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


smile.gif
działa
Dzięki!
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: 15.06.2024 - 00:10