CodeIgniter Forums
[SOLVED]Blueimp's AJAX Chat + CodeIgniter integration - Printable Version

+- CodeIgniter Forums (
+-- Forum: Development (
+--- Forum: CodeIgniter 3.x (
+--- Thread: [SOLVED]Blueimp's AJAX Chat + CodeIgniter integration (/showthread.php?tid=65852)

[SOLVED]Blueimp's AJAX Chat + CodeIgniter integration - dimawebmaker - 08-01-2016

I have a problem with integration Blueimp's AJAX Chat in my project based on CI framework.

In root durectory of my project, I made new folder "chat" and upload inside chat files. After I edit chat /lib/custom.php and write this:

PHP Code:
define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');

When I try to go url: it redirect me on auth page.

After auth, I cant open it keep redirecting me on other controllers of my project. Here is .htaccess

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

So I think after I import this file ../system/core/CodeIgniter.php in chat, it start using route, instead to redirect.

I want open this url, but can't coz CI think that it is another controller.



hi hi I solved this problem, long time ago and just now want to write my solution, maybe it will help someone in future Smile

First need change CI index.php
Need make absolute path
PHP Code:
//$system_path = 'system';
$system_path dirname(__FILE__) . DIRECTORY_SEPARATOR 'system';

//$application_folder = 'application';
$application_folder dirname(__FILE__) . DIRECTORY_SEPARATOR 'application'

Now in Chat's custom.php add this code
PHP Code:
__DIR__ "/../../index.php";
$CI =& get_instance();

Now our auth function in CustomAJAXChat.php will be looks like this:
PHP Code:
function getValidLoginUserData() {

$CI =& get_instance();

$userData = array();
$userData['userID'] = $CI->session->userdata('id');
$userData['userName'] = $CI->session->userdata('name');
$userData['userID']) {
header'Location:'true301 );
$CI->session->userdata('status') == OR $CI->session->userdata('status') == 2) {
$userData['userRole'] = AJAX_CHAT_ADMIN;
        } else {
$userData['userRole'] = AJAX_CHAT_OPERATOR;


All other parts u can write by urself Smile

RE: Blueimp's AJAX Chat + CodeIgniter integration - InsiteFX - 08-02-2016

Create a Chat controller and run it from there.