Consultez la FAQ sur le ZF avant de poster une question
Vous n'êtes pas identifié.
desolé pour l'intitulé mais je suis pas au clair moi meme sur le probleme
je ne sais meme pas ou poster
bref toujours est-il je cherche a securiser mon application
en ce sens je veux bloquer les adresse exotique
parmi c'est adresse exotique j'ai trouvé le
http://localhost/Zfinal/index/33
qui me fait une superbe erreur
Fatal error: Uncaught exception 'Zend_Controller_Action_Exception' with message 'IndexController::33Action() does not exist and was not trapped in __call()' in C:\wamp\www\Zfinal\library\Zend\Controller\Action.php:480 Stack trace: #0 [internal function]: Zend_Controller_Action->__call('33Action', Array) #1 C:\wamp\www\Zfinal\library\Zend\Controller\Action.php(497): IndexController->33Action() #2 C:\wamp\www\Zfinal\library\Zend\Controller\Dispatcher\Standard.php(237): Zend_Controller_Action->dispatch('33Action') #3 C:\wamp\www\Zfinal\library\Zend\Controller\Front.php(911): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #4 C:\wamp\www\Zfinal\index.php(29): Zend_Controller_Front->dispatch() #5 {main} thrown in C:\wamp\www\Zfinal\library\Zend\Controller\Action.php on line 480
pour certain controller qui necessite une adresse genre
http://localhost/Zfinal/index/categorie/id/9
j'ai fait une liste blanche mais que puis je faire dans le cas present ?
d'avance merci
Hors ligne
fait un try catch sur ton dispatch et renvoi sur une page d'erreur le cas écheant. ca me semble la manière la plus simple de le faire.
try{ $frontController->dispatch(); }else{ // vérifie cette synthaxe car j'en suis pas sur ;) $frontController->_redirect(/error/pageIntrouvable); }
Bien sur, il faut que tu es un controller error et une action pageIntrouvable sinon tu vas planter ton server
Hors ligne
La méthode magique __call dans les actions sert à attraper les actions introuvables :
<?php class MyController extends Zend_Controller_Action { public function __call($method, $args) { throw new Exception('Invalid method "' . $method . '" called'); } } ?>
Hors ligne