I have a search-form which is included in almost every page. If a users searches to often (flooding) he gets a message (user-flash) to wait some time. In this case, I want to redirect the user back to the page he came from when he starts the search. (if there is no referrer, the user gets redirected to @homepage). All of that works fine!
But now there is a search-results page, too, that comes from the search-action, where the redirection is done. If the user starts a new search from here and is too fast he gets the flash-message again, but the redirect to the last page is recursively since he came from the same action as he's redirected to. In this case I want to redirect the user to @homepage, too. But I don't know, how to find out, if the referrer matches the current route. Any help will be appreciated! :-) comb On 3 Jun., 03:13, Eno <[email protected]> wrote: > On Wed, 2 Jun 2010, comb wrote: > > Output: > > string '/search/q' (length=9) > > string 'http://localhost:8047/frontend_dev.php/search/q'(length=47) > > boolean false > > > But I would expect the $is_recursive to be true?! > > How can I evaluate if the current route is the same as the referrer > > comes from? :-/ > > Maybe if you told us what you're trying to accomplish, we can suggest > possible solutions. What you're trying to do sounds odd to me, there might > be a better way though. > > > On 3 Jun., 00:28, pghoratiu <[email protected]> wrote: > > > You need to evaluate your routes into a module/action tuple, see the > > > last > > > example on this > > > page:http://pookey.co.uk/wordpress/archives/80-playing-with-symfony-routin... > > > You can probably load the routes separately from the YAML as well. > > > > gabriel > > > > On Jun 3, 12:24 am, comb <[email protected]> wrote: > > > > > yeah but how can I check if the current page is the same as the user > > > > comes from? > > > > > On 2 Jun., 21:20, Eno <[email protected]> wrote: > > > > > > On Wed, 2 Jun 2010, comb wrote: > > > > > > In a executeIndex(...) I want to redirect to the referrer, but only > > > > > > if > > > > > > the referrer is not the current action. > > > > > > How can I do that? > > > > > > > //... > > > > > > $ref = $request->getReferer(); > > > > > > if ($ref != ...what do I need HERE?...) > > > > > > { > > > > > > $this->redirect(empty($ref)?'@homepage':$ref); > > > > > > } > > > > > > } > > > > > > //... > > > > > > > problem is that the getReferer() method returns not a route but a > > > > > > string with the whole http-uri incl. server etc.. > > > > > > That's right - that's what a referrer string > > > > > is.http://en.wikipedia.org/wiki/HTTP_referrer > > > > > > -- > > -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en
