简体   繁体   English

CodeIgniter ion_auth与多个网站

[英]CodeIgniter ion_auth with multiple website

I have two website and use ion auth as login system 我有两个网站,并使用ion auth作为登录系统

the CI structure like this: CI结构如下:

CI_BASE
    - system
    - application
        - site1
            - application
                - config
                - controllers
                - view
                - ...
        - site2
            - application
                - config
                - controllers
                - view
                - ...

and now I want to use site1 as main member page 现在我想使用site1作为主要成员页面

but site2 also can read site1 session and update data to server 但site2也可以读取site1会话并将数据更新到服务器

site1 domain are: http://1.mysite.com/ site1 domain are: http site1 domain are: //1.mysite.com/

site2 domain are: http://2.mysite.com/ site2 domain are: http site2 domain are:

how can I connect two website with same auth? 如何连接具有相同身份验证的两个网站?

Although not a good practice, the database (if you work with this) and the session configuration, must be the same. 尽管不是一个好习惯,但是数据库(如果您使用此方法)和会话配置必须相同。

Files: site1/application/config.php, site2/application/config.php 文件:site1 / application / config.php,site2 / application / config.php

$config['sess_cookie_name'] = 'site_cookie'; // Important! Must be the same name in both sites
$config['sess_expiration'] = 7200;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = TRUE;
$config['sess_use_database'] = TRUE; // If you work with database
$config['sess_table_name'] = 'sessions'; // Important! Must be the same table
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;

The rest is work with your interface and front-end. 其余的工作与您的界面和前端一起使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM