Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Brak sesji, brak zapisanwj sesji po przekierowaniu
grzesza
post
Post #1





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 23.04.2005

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


wiatm
mam maly problem ktory mnie irytuje.

rejestruje sesje i wrzucam do niej wartosc ktora chce przechowac

  1. <? 
  2. //$_SESSION[\"adres\"] = $email;
  3. require_once(&#092;"funkcje/funkcje.php\");
  4.  
  5.  $stat= login($email, $passwd);
  6. if (is_array($stat) )
  7. { $dostep = $stat[0];
  8.  
  9. if ( $dostep == &#092;"aktywne\")
  10. {
  11. //$valid_user = $email;
  12.  
  13. session_register('valid_user');
  14. $_SESSION['valid_user'] = $email;
  15.  
  16.  header(&#092;"Location: mojekonto.php?<?php print SID; ?>\");
  17. exit;
  18. }



po przekierowaniu che sie do tej wartosci dobrac,

  1. <?php
  2.  
  3. switch($id)
  4. {
  5. case &#092;"11\": { dane_op($_SESSION['valid_user']); } break;
  6. case &#092;"111\": { add_op(); } break;
  7. case &#092;"3\": { }break;
  8. default: break;
  9. }
  10.  
  11. ?>


ale jej tam nie ma, tylko wyskakuje mi blad

Notice: Undefined index: valid_user in C:\Inetpub\wwwroot\mojekonto.php on line 42


o co chodz?!

jak to wrzucilem na serwer znajomego to chodzilo ok, na localhost mi sie to tak wykrzacza.
Go to the top of the page
+Quote Post
sobstel
post
Post #2





Grupa: Zarejestrowani
Postów: 853
Pomógł: 25
Dołączył: 27.08.2003
Skąd: Katowice

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


zamiast SID uzyj session_id(). stała SID jest definiowana tylko wtedy jeśli klient nie wysłał odpowiedniego ciastka.


--------------------
"If debugging is the process of removing bugs, then programming must be the process of putting them in..."
sobstel.org
Go to the top of the page
+Quote Post
grzesza
post
Post #3





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 23.04.2005

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


mala poprawka do kodu:
  1. <?php
  2.  
  3. session_register('valid_user');
  4. $_SESSION['valid_user'] = $email; 
  5.  
  6.  header(&#092;"Location: mojekonto.php?id=0\");
  7. exit;
  8.  
  9. ?>
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 Aktualny czas: 22.08.2025 - 07:42