Example with taking user back to referring URL after login prompt |
[eluser]stevefink[/eluser]
Hope I'm elaborating on what I'm trying to do properly. :-) I'm looking for an elegant way for say when a user accesses: http://foo/login/bar , this requires a validated $_SESSION, so it redirects them back to, http://foo/login .. After a successful login, should I just check for something like $_POST['referrer_url'] and refer them back to there afterwards? I'd like the user to be able to get back to http://foo/login/bar instead of say http://foo/login/success_login_landing_page Hope that makes sense. :-) Cheers! - sf
[eluser]alexsancho[/eluser]
Take a look at http://ellislab.com/forums/viewthread/58091/
[eluser]thurting[/eluser]
Here you go... should help you get going First, extend Controller and use this as the parent class for all controllers that need security. Something like below would work - I would stick it in app/libraries - PHP5: Code: <?php if (!defined('BASEPATH')) exit('<h1>Forbidden</h1>'); Then create a controller to use it - something like the following - notice the calling of _authorizeAdmin() - if you call this in the constructor method of an inheriting controller, that controller will have security - the below example loads a model called admin_model and calls an authenticate method to process login - I didn't include this in the post and you can write it yourself: Code: <?php Just to clarify, any controller that inherits from Admin_Controller can have security enabled like so: Code: <?php
[eluser]stevefink[/eluser]
Thanks folks. I've bookmarked the results. I wasn't sure how to properly search the topic when I was originally looking for an answer. My lingo has been slacking! - sf |
Welcome Guest, Not a member yet? Register Sign In |