Welcome Guest, Not a member yet? Register   Sign In
Protecting controller action access
#1

[eluser]davidMC1982[/eluser]
I have a controller method/function/action that produces a CSV file of certain database records. What would be the best way to limit access to this function?

I don't want to use authentication on the site itself, but could use a DB table of allowed URL's or IP's or similar. htaccess would be another option. There's no real data/security issue as it's only data that could be scraped directly from the site anyway.

An external server will be downloading the CSV.

Thanks,

David
#2

[eluser]InsiteFX[/eluser]
Something like this:
Code:
public function index()
{
    // switch ($_SERVER['REMOTE_ADDR'])
    switch ($this->input->ip_address())
    {
        case '245.255.192.248': // IP Address to check for etc;
            // your code here...
            break;

        default:
            $this->load->view('admin/maintmode');
            return;
            break;
    }

}




Theme © iAndrew 2016 - Forum software by © MyBB