Welcome Guest, Not a member yet? Register   Sign In
Using existing session data from a non-CI website in a CodeIgniter website
#1

(This post was last modified: 09-23-2017, 04:48 AM by happyape.)

I have two websites on the same server -
1) subdomain.mydomain.com where users log in. I setup a session cookie with domain as .mydomain.com
2) my second website is at mydomain.com which is a CI powered website and I got a plain php file at mydomain.com/plain.php

In subdomain.mydomain.com/login.php I setup session cookie as

PHP Code:
session_name('mysess');
session_set_cookie_params(0'/''.mydomain.com');
session_start(); 


In http://mydomain.com/Plain.php

PHP Code:
session_name('mysess');
session_set_cookie_params(0'/''.mydomain.com');
session_start();
echo 
'<pre>'print_r($_SESSION); 

In My CodeIgniter website http://subdomain.mydomain.com/application/config.php

PHP Code:
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'mysess';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
$config['cookie_prefix'] = '';
$config['cookie_domain'] = '.mydomain.com'
$config['cookie_path'] = '/';
$config['cookie_secure'] = FALSE;
$config['cookie_httponly'] = FALSE


Once users login at subdomain.mydomain.com I can see the session data at mydomain.com/plain.php without any issues but as soon as I view any page on mydomain.com/mycontroller/mymethod it overwrites the session data and I lose all the session data set after login at subdomain.mydomain.com

I need that data to see that if a user is logged in or not. I don't want users to login twice that's why I setup cookie as above.
What changes do I need to make in CI config to be able to get that data?
Reply


Messages In This Thread
Using existing session data from a non-CI website in a CodeIgniter website - by happyape - 09-22-2017, 08:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB