Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] sesje i obiekty
hhg
post
Post #1





Grupa: Zarejestrowani
Postów: 316
Pomógł: 0
Dołączył: 5.07.2006

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


przypisuję do sesji obiekt:

  1. <?php
  2. class User {
  3.  
  4. var $id;
  5. var $username;
  6. var $password;
  7. var $email;
  8. var $address;
  9.  
  10. var $group;
  11.  
  12. function user($_id,$_username,$_password,$_email,$_address,$_group) {
  13. $this->id = $_id;
  14. $this->username = $_username;
  15. $this->password = md5($_password);
  16. $this->email = $_email;
  17. $this->address = $_address;
  18.  
  19. $this->group = $_group;
  20. }
  21.  
  22. }
  23.  
  24.  
  25. $_SESSION['user'] = new User(
  26. $tab['id'],
  27. $this->tbl['username'],
  28. $this->tbl['password'],
  29. $tab['email'],
  30. $tab['address'],
  31. $db_name
  32. );
  33. ?>



jednak jak poźniej po otworzeniu sesji na innej stronie odwołanie

  1. <?php
  2. $_SESSION['user']->username;
  3. ?>


zwaraca pusty ciąg znakow

dlaczego? źle się odwołuję, a może tak nie można?
Go to the top of the page
+Quote Post

Posty w temacie


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: 20.08.2025 - 10:37