代码点击器在视图中传递数据库session_id [英] code igniter passing database session_id in view

查看:131
本文介绍了代码点击器在视图中传递数据库session_id的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让Uploadify使用代码点火器,但我有同样的问题,为每个人创建一个新的会话ShockWave Flash,而不是拾起已经创建的会话。



我有以下设置

  $ config ['sess_cookie_name'] ='session' 
$ config ['sess_expiration'] = 7200;
$ config ['sess_expire_on_close'] = FALSE;
$ config ['sess_encrypt_cookie'] = TRUE;
$ config ['sess_use_database'] = TRUE;
$ config ['sess_table_name'] ='sessions';
$ config ['sess_match_ip'] = TRUE;
$ config ['sess_match_useragent'] = FALSE;
$ config ['sess_time_to_update'] = 300;

代码Igniter会话表如下所示
WITH BROWSER



<$ c $ p> session_id:73b05af777af0e6a56e7bbba8f9714f6
ip_address:127.0.0.1
user_agent:Mozilla / 5.0(Windows NT 6.1; WOW64)AppleWebKit / 53
last_activity:1310341663
user_data:a:6:{s:5:email; s:32:test@hotmail.com}

WITH UPLOADIFY

  session_id:d39bce3d9c734081379b286449cf56ce 
ip_address: 127.0.0.1
user_agent:Shockwave Flash
last_activity:1310341167
user_data:

我试图黑客这个,并添加浏览器session_id作为获取到php像这样所以所以当uploadify提交我可以检索用户会话数据给定的会话ID。

  $(document).ready(function(){
$('#uploadify')。uploadify({
'uploader':'/ uploadify / uploadify.swf',
'script':'/index.php/upload/uploadify/'.$this->session->userdata('session_id')。'',

我的问题是:
1)是不好的,我在源中公开显示session_id,可用,即使我不这样做吗?
2)在上传控制器上,我如何基本上加载该session_id或从中获取数据?

解决方案


  1. 导致问题的唯一方法是如果您正在加密session_id Cookie,否则您不会向用户提供更多实际数据。 (所以,在大多数情况下,他们可以得到这些数据)

  2. 您需要覆盖 sess_read() code>在您的 MY_Session 类中查看自定义变量,或者您可以修改cookie

基本上:

  public function __construct($ id)
{
// a hack,but you need a hack
$ _COOKIE [$ this-> sess_cookie_name] = $ id;
parent :: __ construct()
}


I am trying to get Uploadify working with code igniter however am having the same problem as everyone with a new session being created for "ShockWave Flash" instead of picking up the already created session.

I have the following setttings set

$config['sess_cookie_name']     = 'session';
$config['sess_expiration']      = 7200;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie']  = TRUE;
$config['sess_use_database']    = TRUE;
$config['sess_table_name']      = 'sessions';
$config['sess_match_ip']        = TRUE;
$config['sess_match_useragent'] = FALSE;
$config['sess_time_to_update']  = 300;

The Code Igniter session table is like so WITH BROWSER

   session_id: 73b05af777af0e6a56e7bbba8f9714f6
   ip_address: 127.0.0.1
   user_agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/53
last_activity: 1310341663
    user_data: a:6:{s:5:"email";s:32:"test@hotmail.com"}

WITH UPLOADIFY

   session_id: d39bce3d9c734081379b286449cf56ce
   ip_address: 127.0.0.1
   user_agent: Shockwave Flash
last_activity: 1310341167
    user_data: 

I'm trying to hack this and add the browser session_id as a get to the php like so so when uploadify submits I can retrieve user session data given the session id.

              $(document).ready(function() {   
                $('#uploadify').uploadify({  
                  'uploader'  : '/uploadify/uploadify.swf',   
                  'script'    : '/index.php/upload/uploadify/'.$this->session->userdata('session_id').'',  

My question is: 1) is it bad that I am showing the session_id publicly in the source, is that session_id available regardless even if I don't do this? 2) On the "upload" controller, how can I essentially "load" that session_id or get data out from it?

解决方案

  1. The only way that would pose a problem is if you're encrypting the session_id cookie -- otherwise, you're not giving the user any more real data. (So, yes, in most cases, they can get that data anyway)
  2. You will need to overwrite sess_read() or __construct in your MY_Session class to look at a custom variable or you could modify the cookie

Basically this:

public function __construct( $id )
{
   // a hack, but you need a hack
   $_COOKIE[ $this->sess_cookie_name ] = $id;
   parent::__construct()
}

这篇关于代码点击器在视图中传递数据库session_id的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆