Prevent user from directly accessing a redirection URL in CakePHP

There are URLs which I use only for redirecting a user after a successful operation. (e.g. a "Thank you" page after submitting feedback).

The problem is that these pages can be accessed directly.

Is there a way to prevent this?

Answers


function thank_you() {
    if($this->referer() != 'some_url') {
        $this->redirect('/');
    }
}

in the method you don't want to be accessible directly, just check to see if the referrer valid (i.e. the "contact form" for the "thank you" page.

If the referrer isn't the "contact form", you can redirect to wherever. If it matches, output the thank you page.


Need Your Help

updating a field with sum of fields in another table

sql sql-server-2005

I'm having great difficulty in finding how to do this. I've been searching for hours but can't come up with a working solution.

Inset triangle in a div using only css

css css3 css-shapes

I have been playing for a long time trying to achieve this using inset shadow css3 property. I would like to inset the blue triangle inside a div like I've seen the outside triangles done using jus...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.