Geting Wrong Session Data using DB Session |
[eluser]Mizanur Islam Laskar[/eluser]
Hello, I'm facing a trouble while using DB Session from the wiki http://codeigniter.com/wiki/DB_Session/. The thing is, my login page is on the home page and when I submit correct ID and Password, it authenticates and show me the correct username as my session value for the first time it redirects to the home page, but after that when I refresh myself that page or go to any other page, I get my session value as "assets"...well, regardless to say that my JS and CSS scripts are placed under mysite/assets/; but I think thats not the issue. Moreover, when I check in my phpMyAdmin, then it also shows that the value against the session variable is stored as "assets"...I think there is a simple fixing there in my code(given below)...so guys, need your expertisements here to help me: My Partial CONTROLLER: Code: class Clients extends Controller My Partial VIEW: Code: <form action="welcome_client" method="post" id="login_form"> My Partial config.php Code: $config['sess_cookie_name'] = 'http://localhost/project/mysite'; My Partial autoload.php Code: $autoload['libraries'] = array('database', 'db_session'); Plz note that I didn't show my model and its relevant controller's function to check my ID and Password against the database, since that part is working fine. So I simplified this post so that I want to store my session from whaever I typed as my ID on the view form.
[eluser]thinkigniter[/eluser]
Hi Mizanur Islam Laskar in your config.php file under config what values do... Code: $config['cookie_prefix']
[eluser]Mizanur Islam Laskar[/eluser]
Code: $config['cookie_prefix'] = ""; Note that I want to test it in my local machine first..so need help on that both for local and in live...thanks in advance
[eluser]thinkigniter[/eluser]
Sorry it's taken a while to get back to you. Try changing your cookie path to... Code: $config['cookie_path'] = "/project/mysite/";
[eluser]Mizanur Islam Laskar[/eluser]
Great to see you again. I have decided not to use db_session. Rather want to use CI's default session library. I've arranged to run it in my local machine. But when I try to run it on a domain server(pmsdap.mgncare.com), it shows successful message when it first redirect to a page, but when I get back to homepage, that session info is lost!! Here is my partial of config.php: Code: $config['sess_cookie_name'] = 'pmsdap'; Plz note that my server(pmsdap.mgncare.com) is running in PHP-5.0.4, where its 5.2.5 in my local machine Again, thanks in advance.
[eluser]thinkigniter[/eluser]
Got a question... Shouldn't you be checking to see if the session data is set and then setting an d refreshing. The way your code looks, to me, is that the next the page loads the session data is set again but with a NULL value. E.G. Code: class Clients extends Controller Or am I wrong? |
Welcome Guest, Not a member yet? Register Sign In |