• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
run script that is behind a protected directory

I have written a ajax query that runs a codeigniter script. The rest of the CI application is the back end of the database.

How can I run this script but protect the rest of the CI app using protected directories.

[eluser]Pascal Kriete[/eluser]
What do you mean with 'protected directories'? The only access point for a CI app is index.php .

i mean htaccess password protected directories

the whole application needs to be behind it, but i want to give access to one script so that it can be called for the ajax query that we run.

The only other options I could think would be two codeigniter installations.

[eluser]Pascal Kriete[/eluser]
I can't think of anything very nice, but I can think of a hack.

Duplicate the system/codeigniter/codeigniter.php and call it anything you want (codeigniter2 for all I care). Put it in the same folder.

In that file, right after:
$CFG =& load_class('Config');
$URI =& load_class('URI');
$RTR =& load_class('Router');
$OUT =& load_class('Output');

Force the one allowed path by doing:
$RTR->set_directory('directory_of_the_controller');  //make it blank if you're not using folders
$RTR->set_class('class_name');   // What your first uri segment would normally be
$RTR->set_method('method_name');  // What your second segment would be

Then, on the public side you create another index.php file identical to the regular one. Change the paths to the system and application folders to point to your protected directory.

At the bottom of the file change the require_once to point at your new codeigniter2.php file. Now your ajax call can call that new index.php .

It's a hack, but it should work. Remember that anything your js has access to, anyone will have access to.

[quote author="inparo" date="1211057229"] Remember that anything your js has access to, anyone will have access to.[/quote]

With that in mind I think I will just run a second CI install and cut and paste the neccessary code to this application

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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