Welcome Guest, Not a member yet? Register   Sign In
how to protect a controller function accessing by URL
#1

[eluser]Tracker[/eluser]
I don't want to access "deleteItems" function directly like this.
http://localhost/Shop/deleteItems/3

it should only accessible if i will call
http://localhost/Shop/deleteShop/3

Your help will be appreciated...

Code:
class Shop extends Controller {

    function deleteShop()
    {
        $this-> deleteItems($shopId);
        //….

    }

    function deleteItems($shopId)
    {
        //….

    }
}
#2

[eluser]danmontgomery[/eluser]
This is covered in the user guide.

Quote:In some cases you may want certain functions hidden from public access. To make a function private, simply add an underscore as the name prefix and it will not be served via a URL request. For example, if you were to have a function like this:

Code:
function _utility()
{
  // some code
}
Trying to access it via the URL, like this, will not work:

Code:
example.com/index.php/blog/_utility/
#3

[eluser]Tracker[/eluser]
Thank you very much.




Theme © iAndrew 2016 - Forum software by © MyBB