dreamworld2007 2015-03-31 11:03
浏览 63

Codeigniter ci_sessions表存储ip地址为0.0.0.0为什么? 即使托管我也得到0.0.0.0

Hello in my codeigniter I have created table as ci_sessions with following fields

CREATE TABLE IF NOT EXISTS  `ci_sessions` (
    session_id varchar(40) DEFAULT '0' NOT NULL,
    ip_address varchar(45) DEFAULT '0' NOT NULL,
    user_agent varchar(120) NOT NULL,
    last_activity int(10) unsigned DEFAULT 0 NOT NULL,
    user_data text NOT NULL,
    PRIMARY KEY (session_id),
    KEY `last_activity_idx` (`last_activity`)
);

Every field is working fine, except ip address which is storing as 0.0.0.0 for every client. I have edited my config.php as below.

$config['sess_cookie_name']     = 'ci_session';
$config['sess_expiration']      = 7200;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie']  = FALSE;
$config['sess_use_database']    = TRUE;
$config['sess_table_name']      = 'ci_sessions';
$config['sess_match_ip']        = TRUE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update']  = 300;
  • 写回答

1条回答 默认 最新

  • doushi1510 2015-04-09 15:57
    关注

    With Linode your app is likely behind a proxy. You can either find out your proxy IP and add it to the whitelist in your CodeIgniter config file (bottom of /application/config/config.php), or follow the directions on Linode's Nodebalancer Reference for using the Apache mod_rpaf module to remap X_FORWARDED_FOR to REMOTE_ADDR.

    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大