Reputation: 317
I've an upload script which once something is uploaded theres a 5 minute session inwhich the user can edit the title for their upload. It's all working fine with when the session is just a local cookie with these settings:
$config['sess_cookie_name'] = 'if_session';
$config['sess_expiration'] = 300;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = TRUE;
$config['sess_use_database'] = FALSE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;
Now when i try to alter this to use the ci_sessions table i change 'sess_encrypt_cookie' to false and to true 'sess_use_database'.
The data now shows in the database but my session detection code doesn't find any session!
<?php if ($this->session->userdata('edit')) : ?>
<?php $session_info = $this->session->userdata('edit'); ?>
<?php $ids_array = explode(",", $session_info['image_id']); ?>
<?php foreach ($ids_array as $id): ?>
<?php
if ($id == $alpha_id
&&
$this->session->userdata('ip_address') == $_SERVER['REMOTE_ADDR']
&&
$session_info['session_id'] == $this->session->userdata('session_id')) :
?>
Can anyone see why it'd work with cookies and not now? Thanks
more info: db config http://pastebin.com/qDbBQu8h
session CHECK code http://pastebin.com/cSmZqcAE
session SET code http://pastebin.com/wZf3mGW5
Upvotes: 2
Views: 1724
Reputation: 4250
The problem seems to be in this line:
'session_id' => $this->session->set_userdata('session_id')
You are using set_userdata instead of userdata.
Upvotes: 1
Reputation: 1310
have you load codeigiter session library ? look like you not loaded session library yet, make sure load the library first from autoload.php or from you controller,
$this->load->library('session');
Upvotes: 0