Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> klasa gubi sesje
M45t3r
post
Post #1





Grupa: Zarejestrowani
Postów: 133
Pomógł: 0
Dołączył: 16.05.2005
Skąd: Lubaczów

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


Witam.
Mój problem wygląda następująco:
Tworzac panel admina opieram go póki co na sesjach. Do tego później dołożę cookies. Problem polega na tym, że w chwili obecnej
z nieznanego mi powodu klasa gubi mi tablicę $_SESSION. Kod wygląda następująco:
index.php
  1. <?php
  2. $admin = new admin;
  3. if(@$_GET['log'] === 'in'){
  4. $admin->check_form('root','test');
  5. }
  6. elseif(@$_GET['log'] === 'out'){
  7. $admin->logout();
  8. }
  9. elseif($admin->check_access()){
  10. echo 'witaj w PA';
  11. }
  12. else{
  13. print_r($_SESSION); //notice: Undefined variable: _SESSION in (...)
  14. echo $admin->login_form();
  15. }
  16. ?>

admin.class.php
  1. <?php
  2. public function give_access($login,$password){
  3. $_SESSION['admin'] = true;
  4. }
  5.  
  6. public function check_form($login,$password){
  7. $this->give_access($login,$password);
  8. print_r($_SESSION); //Array ( [admin] => 1 )
  9. //header("Location: index.php");
  10. }
  11.  
  12. public function check_access(){
  13. if(session_is_registered('admin') ){
  14. return true;
  15. }
  16. else{
  17. return false;
  18. }
  19.  
  20. }
  21. ?>
Go to the top of the page
+Quote Post

Posty w temacie
- M45t3r   klasa gubi sesje   25.12.2006, 18:01:23
- - faster   A może problem tkwi w tym, że nie wystartowałeś se...   27.12.2006, 00:22:27


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: 4.10.2025 - 23:18