Welcome Guest, Not a member yet? Register   Sign In
CI 2.0.2 using Session library with oracle
#1

[eluser]Unknown[/eluser]
hello
i want to use codeigniter session library with Oracle. first problem i got was the create session table syntax, anyhow i fix it myself and created a table in oracle manually. but after saving userdata into session, that data is only available in the same page. when i call a redirect function the userdata gets vanished.

For example. i created a login controller which validates the user name and password and if it is wrong then creates a message and save into userdata, before redirecting to login view i am able to get all data i have set, but after redirect to login view it vanishes,

I have also test the same code with mysql database and it works fine.

kindly tell me whats wrogn, mysql session table create code is
CREATE TABLE "GCINTRANET"."TBL_SESSIONS"
(
"SESSION_ID" VARCHAR2(40 BYTE) DEFAULT '0' NOT NULL ENABLE,
"IP_ADDRESS" VARCHAR2(16 BYTE) DEFAULT '0' NOT NULL ENABLE,
"USER_AGENT" VARCHAR2(50 BYTE) NOT NULL ENABLE,
"LAST_ACTIVITY" NUMBER(*,0) DEFAULT 0 NOT NULL ENABLE,
"USER_DATA" VARCHAR2(4000 BYTE) DEFAULT '',
CONSTRAINT "TBL_SESSIONS_PK" PRIMARY KEY ("SESSION_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" ENABLE
)
#2

[eluser]Unknown[/eluser]
This works fine if i load a login view by calling

Code:
$this->load->view('login_view');

problem occur when i call a redirect

Code:
redirect(base_url().'login')
#3

[eluser]Unknown[/eluser]
He had the same problem and solved by changing the file session.php

lines 224 a 234...
change the words user_data to uppercase (user_data to USER_DATA).

as was...
if (isset($row->user_data) AND $row->user_data != '')
{
$custom_data = $this->_unserialize($row->user_data);

if (is_array($custom_data))
{
foreach ($custom_data as $key => $val)
{
$session[$key] = $val;
}
}
}

should be and how it works ... I'm using!
if (isset($row->USER_DATA) AND $row->USER_DATA != '')
{
$custom_data = $this->_unserialize($row->USER_DATA);

if (is_array($custom_data))
{
foreach ($custom_data as $key => $val)
{
$session[$key] = $val;
}
}
}




Theme © iAndrew 2016 - Forum software by © MyBB