Solved

using $_SESSION in mixed codeigniter enivronment

Posted on 2011-09-19
3
691 Views
Last Modified: 2012-05-12
Hello,

I am working on a project that (for some reason) has mixed a codeigniter environment with a standard php environment.  Codeigniter based pages have urls to non-codeigniter pages.

I can't seem to get $_SESSION to work.  Cookies are enabled and the session_start is not called until i enter the non-codeigniter code.

Anyone aware of any issues with $_SESSION getting clobbered or disabled  by codeigniter?

Thanks,
0
Comment
Question by:DanRaposo
3 Comments
 
LVL 29

Accepted Solution

by:
fibo earned 500 total points
ID: 36567484
Seems that yes there is a problem with CI, as shown in places such as

http://codeigniter.com/forums/viewthread/73057/#361671 (I would test the first solution of simply placing a session_start(); in all CI pages)

http://codeigniter.com/user_guide/libraries/sessions.html indicates that CI manges its own way session data, so you might consider to build a small php that you would include at the start of each php non-CI page.
Seems that http://codeigniter.com/wiki/Native_session/ would give you a nice solution
0
 
LVL 6

Expert Comment

by:jjperezaguinaga
ID: 36570214
Greetings DanRaposo,

I strongly suggest that you use the native session class CodeIgniter provides. $_SESSION has issues with CodeIgniter. There's no point of using a Framework if you are not going to take advantage of its libraries. If I were you, I would give a look to the Session User Guide (http://codeigniter.com/user_guide/libraries/sessions.html) and replace $_SESSION in your application.

Best regards,
-JJ
0
 

Author Comment

by:DanRaposo
ID: 36980267
Gang,

Unfortunately, we inherited a system that is a mix of CI and non-CI.  We'll just have go one way or the other to resolve this.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

There is a huge demand for CodeIgniter among the PHP web developers due to its dynamic features and benefits these days. It is one of most popular and agile open source PHP framework for creating robust web applications in PHP web development field.…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now