Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [ZendFramework]Błąd z biblioteką Zenda
Czapla
post 23.11.2009, 18:16:07
Post #1





Grupa: Zarejestrowani
Postów: 130
Pomógł: 3
Dołączył: 10.12.2007
Skąd: Bielsko-Biała

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


  1. <?php
  2. class UwierzytelnienieController extends Zend_Controller_Action
  3. {
  4. public function init()
  5. {
  6. }
  7.  
  8. public function indexAction()
  9. {
  10. }
  11.  
  12. public function loginAction() {
  13. if(Zend_Auth::getInstance()->hasIdentity()) {
  14. $this->_redirect('index/index');
  15. }
  16.  
  17. $zadanie = $this->getRequest();
  18. $form = new Form_LogForm();
  19. if($zadanie->isPost()){
  20. if($form->isValid($this->_request->getPost())) {
  21. $uwierzAdapter = $this->pobierzUwierzAdapter();
  22.  
  23. $ope_login = $form->getValue('ope_login');
  24. $ope_haslo = $form->getValue('ope_haslo');
  25.  
  26. $uwierzAdapter->setIdentity($ope_login)
  27. ->setCredential($ope_haslo);
  28.  
  29. $uwierzytelnienie = Zend_Auth::getInstance();
  30. $wynik = $uwierzytelnienie->authenticate($uwierzAdapter); //uwierzytelnienie
  31.  
  32. if($wynik->isValid()){
  33. $identyfikacja = $uwierzAdapter->GetResultRowObject();
  34. $uwierzMagazyn = $uwierzytelnienie->getStorage(); //getStorage();
  35. $uwierzMagazyn ->write($identyfikacja);
  36.  
  37. $this->_redirect('index/index');
  38. echo 'zalogowano';
  39. } else {
  40. $this->view->komunikatBledu = 'Błąd logowania!';
  41. }
  42. }
  43. }
  44. $this->view->form = $form;
  45. }
  46. public function logoutAction()
  47. {
  48. Zend_Auth::getInstance()->clearIdentity();
  49. $this->_redirect('index/index');
  50. }
  51.  
  52. private function pobierzUwierzAdapter() {
  53. $uwierzAdapter = new Zend_Auth_Adapter_DbTable(Zend_Db_Table::getDefaultAdapter());
  54. $uwierzAdapter->setTableName('sys_operatorzy')
  55. ->setIdentityColumn('ope_login')
  56. ->setCredentialColumn('ope_haslo');
  57.  
  58. return $uwierzAdapter;
  59. }
  60. }

  1. class Form_LogForm extends Zend_Form {
  2. public function __construct($option = null) {
  3. parent::_construct($option);
  4.  
  5. $this->setName('login');
  6.  
  7. $ope_login = new Zend_Form_Element_Text('ope_login');
  8. $ope_login->setLabel('Operator')
  9. ->setRequired();
  10.  
  11. $ope_haslo = new Zend_Form_Element_Password('ope_haslo');
  12. $ope_haslo->setLabel('Hasło')
  13. ->setRequired(true);
  14.  
  15. $login = new Zend_Form_Element_Submit('login');
  16. $login -> setLabel('Login');
  17.  
  18. $this->addElements(array($ope_login, $ope_haslo, $login));
  19. $this->setMethod('post');
  20. $this->setAction(Zend_Controller_Front::getInstance()->getBaseUrl().'index/index');
  21. }
  22. }


gdy zarymuje 18 linijkę i 44 linijkę
a zamiast
  1. $ope_login = $form->getValue('ope_login');
  2. $ope_haslo = $form->getValue('ope_haslo');

wprowadze
  1. $ope_login = 'admin'
  2. $ope_haslo = 'admin'

WSZYSTKO DZIAŁA!
natomiast w tej postaci wyświetla mi błąd
Fatal error: Class 'Form_LogForm' not found in C:\wamp\www\srodki\application\controllers\UwierzytelnienieController.php on line 18
Struktura jest taka
application->forms->LogForm.php
application->controllers->UwierzytelnienieController.php

Bardzo proszę o pomoc, siedze nad tym od 13.00 i nic nie moge wykombinować, pewnie jakieś trywialne przeoczenie ....


--------------------
Life is a game, continue playing and try to be a pr0.
Go to the top of the page
+Quote Post
seth-kk
post 23.11.2009, 18:27:54
Post #2





Grupa: Zarejestrowani
Postów: 444
Pomógł: 79
Dołączył: 26.05.2009

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


a masz poprawnie skonfigurowanego autoloadera?


--------------------
Go to the top of the page
+Quote Post
Czapla
post 23.11.2009, 18:51:25
Post #3





Grupa: Zarejestrowani
Postów: 130
Pomógł: 3
Dołączył: 10.12.2007
Skąd: Bielsko-Biała

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


kuźwa wiedziałem że coś mi sie z bootstrapu usuneło ...

DZIAŁA!


--------------------
Life is a game, continue playing and try to be a pr0.
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.2025 - 19:32