Direct access to views

I have a small question regarding views.

I am working on a login system for a new web application.
When users log in and validated their username and password, the variable logged_in in the session changes to true.

My question is:
Is it possible to access views via url's?

If not, then i can just check the loggin boolean at the beginning of the functions after users logged in.

[eluser]Glen Swinfield[/eluser]
You cannot map an URL to a view, just make a controller method that includes your view and nothing else.

class Test extends Controller
function my_view(){



I was afraid people could get to my view by putting

in the address bar!

but its solved thanSmile

This is possible if you allow the view file as a stand alone file which is the case on most servers but you could set server restrictions in the .htaccess or the webserver configuration or you can add following line to the beginning of each view file
if (!defined('BASEPATH')) exit('No direct script access allowed');

Additionally, it's generally wise to keep all files out of the webroot unless necessary. CI makes this very easy, and the only things I have left in the webroot are css/js/image files, an index.php and .htaccess for each application, and ci_config.php and .htaccess in my CI directory (above the application dirs).

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.