Welcome Guest, Not a member yet? Register   Sign In
n00b session problems
#1

[eluser]pdriessen[/eluser]
I made the follow test controller:
Code:
<?
class Test extends Controller {
    # START INDEX    
    function index()
        {
        $this->load->library('session');
        
        echo "</br>session_id: ";
        echo $this->session->userdata('session_id');
        
        echo "</br>test_key: ";
        echo $this->session->userdata('test_key');
        
        $this->session->set_userdata('test_key', 'test_value');
        
        echo "</br>session_id: ";
        echo $this->session->userdata('session_id');
        
        echo "</br>test_key: ";
        echo $this->session->userdata('test_key');
    } # EINDE INDEX
}
?&gt;
when I open this file I get this output:
Code:
session_id: 100c0ab06df21aeaa2e4b183ebb22fa8
test_key:
A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home/shoppeni/_si/system/application/controllers/beheer/test.php:10)

Filename: libraries/Session.php

Line Number: 662


session_id: 100c0ab06df21aeaa2e4b183ebb22fa8
test_key: test_value

The output and the error message are correct. The only problem is that when i refresh the page, I get a new session_id number and the previous set test_key had gone...

Anybody knows what I do wrong?


Messages In This Thread
n00b session problems - by El Forum - 03-13-2010, 05:06 PM
n00b session problems - by El Forum - 03-14-2010, 03:35 AM
n00b session problems - by El Forum - 03-14-2010, 05:32 AM
n00b session problems - by El Forum - 03-14-2010, 06:49 AM
n00b session problems - by El Forum - 03-15-2010, 01:29 AM



Theme © iAndrew 2016 - Forum software by © MyBB