Welcome Guest, Not a member yet? Register   Sign In
how to write view on constructor function
#11

[eluser]bretticus[/eluser]
[quote author="Zangetsu" date="1252756305"]url helper function redirect() is greet ! Smile

Code:
function Welcome() {
    parent::Controller();
    if(!$this->auth->hasRole('admin')) {
         redirect("http://localhost/codeigniter/index.php/account/loginForm");
    }
}

problem solved. thanks for your helps.[/quote]

Just wanted to point something out. A redirect will work great and is secure for the most part because any browser should obey the 302 header to redirect. However, unless you stop the execution of the script (exit or die), you will still write the contents of the page to the browser. Now, you can't see this data with your browser, but there are certainly other ways of getting the raw headers and content to take a peak.

Since I found and installed jing tonight (a free screencast app for mac & windows: woohoo!) I decided to be a nerd and demonstrate (try not to laugh %-P ) If you're interested click here.

Of course it if there's nothing to hide on the protected page, this is not such a big deal.
#12

[eluser]überfuzz[/eluser]
[quote author="bretticus" date="1252759458"]I decided to be a nerd and demonstrate (try not to laugh %-P )[/quote]
No, thats excellent nerdiness! Two points coming you way through cyberspace.




Theme © iAndrew 2016 - Forum software by © MyBB