Consultez la FAQ sur le ZF avant de poster une question
Vous n'êtes pas identifié.
Bonjour,
[g]Déjà je précise que j'ai chercher avant de poster ![/g]
Alors voilà je suis entrain de créer mon espace membre avec ZF . Mais j'ai un petit souci :
Warning: Zend_Loader::include_once(users.php) [zend-loader.include-once]: failed to open stream: No such file or directory in /home/zftest/public_html/library/Zend/Loader.php on line 83 Warning: Zend_Loader::include_once() [function.include]: Failed opening 'users.php' for inclusion (include_path='.:./library:./application/models:.:/usr/local/lib/php') in /home/zftest/public_html/library/Zend/Loader.php on line 83 Fatal error: Uncaught exception 'Zend_Exception' with message 'File "users.php" does not exist or class "users" was not found in the file' in /home/zftest/public_html/library/Zend/Loader.php:88 Stack trace: #0 /home/zftest/public_html/application/controllers/AuthController.php(10): Zend_Loader::loadClass('users') #1 /home/zftest/public_html/library/Zend/Controller/Action.php(118): AuthController->init() #2 /home/zftest/public_html/library/Zend/Controller/Dispatcher/Standard.php(261): Zend_Controller_Action->__construct(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http), Array) #3 /home/zftest/public_html/library/Zend/Controller/Front.php(934): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #4 /home/zftest/public_html/index.php(43): Zend_Controller_Front->dispatch() #5 {main} thrown in /home/zftest/public_html/library/Zend/Loader.php on line 88
Mais je comprend pas pourquoi y me demande une page users.php alors que jamais dans mon code je la demande :
AuthController.php
<?php class AuthController extends Zend_Controller_Action { function init() { $this->initView(); Zend_Loader::loadClass('users'); $this->view->baseUrl = $this->_request->getBaseUrl(); $this->view->user = Zend_Auth::getInstance()->getIdentity(); } function indexAction() { $this->_redirect('/'); } function loginAction() { $this->view->message = ''; if ($this->_request->isPost()) { Zend_Loader::loadClass('Zend_Filter_StripTags'); $f = new Zend_Filter_StripTags(); $username = $f->filter($this->_request->getPost('username')); $password = $f->filter($this->_request->getPost('password')); if (empty($username)) { $this->view->message = 'S\'il vous plait fournir un nom d\'utilisateur !'; } else { Zend_Loader::loadClass('Zend_Auth_Adapter_DbTable'); $dbAdapter = Zend_Registry::get('dbadapter'); $authAdapter = new Zend_Auth_Adapter_DbTable($dbadapter); $authAdapter->setIdentityName('users'); $authAdapter->setIdentityColumn('username'); $authAdapter->setCredentialColumn('password'); $authAdapter->setIdentity($username); $authAdapter->setCredencial($password); $auth = Zend_Auth::getInstance(); $result = $auth->authenticate($authAdapter); if ($result->isValid()) { $data = $authAdapter->getResulRowObjet(null, 'password'); $auth->getStorage()->write($data); $this->_redirect('/'); } else { $this->view->message = 'Echec de la connexion !'; } } } $this->view->title = "Connetez-vous !"; $this->render(); } function logoutAction() { Zend_Auth::getInstance()->clearIdentity(); $this->_redirect('/'); } } ?>
et login.phtml
<center> <img src="<?php echo $this->baseUrl(); ?>/public/images/headerbeta.jpg" title="La Lyre en Délire" href="<?php echo $this->url(array('controller'=>'index', 'action'=>'index')); ?>" /> </center> <div id="menu"> <a href="<?php echo $this->url(array('controller'=>'index', 'action'=>'index')); ?>">Accueil</a> <a href="<?php echo $this->url(array('controller'=>'historique', 'action'=>'historique')); ?>">Histoire</a> <a href="<?php echo $this->url(array('controller'=>'trombinoscope', 'action'=>'trombinoscope')); ?>">Trombinoscope</a> <a href="<?php echo $this->url(array('controller'=>'repertoire', 'action'=>'repertoire')); ?>">Répertoire</a> <a href="<?php echo $this->url(array('controller'=>'calendrier', 'action'=>'calendrier')); ?>">Calendrier</a> <a href="<?php echo $this->url(array('controller'=>'contacter', 'action'=>'contacter')); ?>">Contact</a> </div> <div id="page"> <?php if(!empty($this->message)) ?> <div id="message"> <?php echo $this->escape($this->message); ?> </div> <?php endif; ?> <form action="<?php echo $this->baseUrl(); ?>/auth/login" method="port"> <div> <label for="username">Pseudo :</label> <input type="text" name="username" value="" /> </div> <div> <label for="password">Mots de passe :</label> <input type="password" name="password" value="" /> </div> <div id="formbutton"> <input type="submit" name="login" value="Connection" /> </div> </form> </div> <div id="copyright"> .:! © tiim-zero1 !:. .:! Design by <a href="mailto:tim01@hotmail.fr">Timothé</a> pour <a href="<?php echo $this->url(array('controller'=>'index', 'action'=>'index')); ?>">La Lyre en délire</a> !:. .:! Tout droit réservé !:. </div> </div>
Si vous voulez tester ces ici
Dernière modification par tim01 (03-11-2008 12:08:58)
Hors ligne
Salut,
function init() { $this->initView(); Zend_Loader::loadClass('users'); $this->view->baseUrl = $this->_request->getBaseUrl(); $this->view->user = Zend_Auth::getInstance()->getIdentity(); }
Dans ta méthode Init tu demande au Zend_Loader du charger la classe users. C'est donc normal qu'il t'informe qu'il ne trouve pas le fichier users.php
Soit il faut supprimer cette ligne si elle ne te sert pas, soit il faut modifier l'emplacement de ce fichier.
Hors ligne
C'est aussi gros que le nez sur la figure ..
#0 ... /AuthController.php(10): Zend_Loader::loadClass('users') #1 ... /Action.php(118): AuthController->init()
ligne 10, dans ta fonction init :
Zend_Loader::loadClass('users');
Il cherche a chargé une classé nommé User.
Comme il ne connait pas la classe, il tente te trouvé un fichier (portant son nom) de la chargé.
Hors ligne
Merci sa marche !
J'ai chercher de partout et pourtant j'ai pas trouver merci beaucoup !
Hors ligne