douxiong3234 2013-11-23 06:40
浏览 33

使用相同的IP地址保存2个PHPSESSID访问计算机

Server is WAMP. I have 2 sugarcrm sites, one for production say, saved at www/folder1 , other for development say saved at www/folder2 . I am accessing them using IP address (say 66.102.0.0/folder1 and 66.102.0.0/folder2 ) . Browser saves 1 cookie (PHPSESSID) for both of them. If I login/logout to first site, it effects other site also. I can create subdomain at localhost like folder1.localhost and folder2.localhost but how IP based sub-domain is possible like, folder1.66.102.0.0 and folder2.66.102.0.0 (looks funny :) ) ?Or can I use different port for different folder, like 66.102.0.0:80 and 66.102.0.0:8080 ?Then will browser saved 2 cookies, if port is different on same ip address?I can't change login/logout, it's sugarcrm not core php. I can use different browsers but my boss is saying to make cookies separately. Or is there any browser Add-on that separates cookies based on folder?

  • 写回答

2条回答 默认 最新

  • duanhan4763 2013-11-23 06:48
    关注

    Call session_set_cookie_params() to restrict the cookie to a particular folder:

    $params = session_get_cookie_params();
    session_set_cookie_params($params['lifetime'], '/folder1');
    session_start();
    
    评论

报告相同问题?

悬赏问题

  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 关于#python#的问题:自动化测试