0

I'm using Codeigniter and facing the following problem.

In a controller, I want to include in some way an application (Not written in Codeigniter) in my controller. I am using file_get_contents now. It's working fine and the application is shown in the controller I made. The problem is, the application contains a lot of forms which are posted to other pages in the application itself. Using file_get_contents, the forms redirect the user to a target outside my controller. This may sound a bit vague, so here's an example:

The user navigates to the controller: 'game/login' and therefore wants to visit the login page. The user fills in the form. The form posts the data to assets/game/index.php?page=login. This makes the user redirect to assets/game/index.php?page=login, and therefore making him leave the controller page.

Does anyone have an idea on how to fix this problem?

defined('BASEPATH') OR exit('No direct script access allowed');
class Game extends CI_Controller{

    public function __construct(){
        parent::__construct(); 
    }


    public function index($page = ''){  
        file_get_contents(FCPATH . 'assets/game/index.php?page=' . $page);
    }

}
P.Yntema
  • 576
  • 2
  • 9
  • 29

1 Answers1

0

You can load your external php pages in a iframe but i would suggest you should convert your php files to codeigniter MVC structure to get the advantages.

The quick way is using iframe,but i would ask you to refer this post to get an idea on Iframes when to use & when not to. Are iframes considered 'bad practice'?

Community
  • 1
  • 1
Zeeshan
  • 803
  • 6
  • 15