Welcome Guest, Not a member yet? Register   Sign In
Securing controller's
#2

[eluser]CroNiX[/eluser]
I suppose it depends on your goal and I assume you want at least one person to be able to access the url. If so, you'd need some sort of authentication system and only allow authenticated users or users with sufficient permissions to view the url.

If it's a helper type of method that you never want to be able to access via the url, but want other methods within the class to still be able to access, you just prefix the method name with an underscore.

Code:
class Something extends CI_Controller {

  //not accessible via url
  function _get_users()
  {
    return $this->users;
  }
  
  //accessible via url
  function get_users()
  {
    return $this->users;
  }
}

Going to http://yoursite.com/something/_get_users will result in an error because it's a "private" method.
Going to http://yoursite.com/something/get_users will work.


Messages In This Thread
Securing controller's - by El Forum - 11-14-2013, 03:28 PM
Securing controller's - by El Forum - 11-14-2013, 05:12 PM



Theme © iAndrew 2016 - Forum software by © MyBB