I’m using CI 2.1.4 and I set
$config['sess_expiration'] = 0;
but sometime when I’m in my dashboard I’m unlogged automaticaly by the site…
The context is the following :
I’m using 2 applications for 1 system, but both applications use the same encryption key, session table and the same timeout.
This problem appear when I submit a form then after I pick up session data to add it in the database.
Anyone has an idea ?
Thanks.
I think you have 2 ways to fix it.
First, you should download latest code from github and replace session library folder with downloaded code.
Second, you can extends the session library and check for AJAX request, then update the session as you can see this following discussion about this problem in CodeIgniter Official Forum, it explains to get rid of the problem: http://ellislab.com/forums/viewthread/138823/
Note: The forum location has changed http://ellislab.com/forums/ to http://forum.codeigniter.com and it is hard to find the topic there. You can search if you like or you can follow the #1.
Hope it will helps you.
Related
I´m currently working on a big project with is based on php and its connected to a mysql database. I wanna track the actions the clients are doing in a file. If they login I wanna log who is logging in. I wanna log when someone is adding data with a submit button to the db and who is adding the data.
Does someone of you have a example how he did it, or have an idea how to do that?
I hope you understand what I mean :)
Best regards
There are already libraries that can do it for you. One of them is Monolog. Follow doc in README in order to set it up in your project.
I am using Codeigniter. I have not encountered such an error in a long time. In my login function inside my login controller, I want to print an array returning from the Login Model to the session. I also use Elephant.io. $this->session->set_userdata($validate); $client->emit('form_data', ['success' => $this->session->all_userdata()]); when I write the array named $validate to the session, it sends all the data of the session to nodejs with emit at the bottom and there I'm printing to the console.
So when I send $this->session->all_userdata() with emit I can see the data in the $validate array. For your information, the issue has nothing to do with NodeJS. However, when I refresh the page, all the data I have written in the session is deleted. As a solution, I tried $this->session->set_userdata('uid', $validate) instead of $_SESSION['uid'] = $validate and it didn't work. I've read articles on various sites about this topic on the internet or looked at the same problems and solutions on stackoverflow and similar platforms, but there was no solution to my problem. In the same controller in the construct function $this->session->set_userdata('uid', 'test'); print_r($this->session->all_userdata()); die();When I print this the 'test' data is not deleted even if I refresh the page hundreds of times. So it works inside the construct. I am calling session library in Construct.
I haven't been able to solve this problem for 2 days now, I've reached the stage of going crazy. I have explained my problem at length here, I hope a solution is found. I am using the latest version of Codeigniter. My PHP version is 7.3.11 I am using Ampps as apache server. Thanks to everyone who has helped so far <3
I know there is a ready to use API for facebook, but since I last tried the API they change to much, now you need permissions an checks for everything you want to do ...
This project is only for personal usage, therefore I don't care about give my facebook password.
My goal is to make an comment to an picture on a facebook page, in this test aviciis
I created my first git repo https://github.com/fritz-net/facebook-AntiAPI because i have 4 files. For login etc. I hope this messy testing code is readable
The problem is that facebook shows an error that something happened (no acces, wrong page, out of date,... - German stuff),... even though the http headers are the same and the post data too. There is no point why facebook should not save this comment like any other. The login also worked well.
I'm using the mobile version because with the ajax/json version i had no real success either.
I hope I forget nothing about my problem in my tiredness. I tried to find other code from people who had done this, but everyone uses the api and I also tried to solve the problem myself for the last 6 hours (from about 02am till now 8) please excuse my bad English writing, dirty code and missing things
Maybe someone can give me a hint, good night
It turned out that solution was very easy.
in the api.class.php there is a regex where I read out the form action, I added the following $action = str_replace("&", "&", $action); and everything worked.
The problem where the html entities in the action url of the form
EDIT: I committed the changes to github for anyone interested
i have problem with php cake session and subdomains. I have setted all successfully right. When i try to go from
subdomain1.domain.com
to
subdomain2.domain.com
all works nicely when i put these browser url... problem comes when i try to make this with <a href=""> tag, on redirected subdomain i will recieve new session id.
I cant explain to my self how can be this possible, pure php script works fine but in php cake is this bug! thanks for any suggestion...
ok, i debug whole php cake session component and lib, i figure out 2 sollutions
easier - set in core.php security level to low
Configure::write('Security.level', 'low');
advanced - make new config file for sessions, like Ivo said, its in tutorial http://book.cakephp.org/view/1310/Sessions ,most important thing is set
ini_restore('session.referer_check');
because by default php cake check referrer, and if it goes not form same domain it will cause generating new SESSIONID
I don't think it's related with cake.
By default, PHP will give you a session for the domain.
subdomain1.domain.com is a domain,
subdomain2.domain.com is another domain
domain.com is another different domain
www.domain.com is another different domain
All thoses examples are 4 distincts domains, with their own session.
If you want to share the session between many (sub)domain, you can try to set the session.cookie_domain variable, like this;
ini_set("session.cookie_domain","domain.com") ;
Try using this instead:
http://book.cakephp.org/view/1310/Sessions
Follow the directions to create custom configuration for cake's session saving.
Building pizza delivery site.
Currently using:
Language: PHP
Framework: codeigniter
class: Cart Class
Autoloaded: session
Products can be easily added into the cart in FF,safari,chrome. but does not seem to be working in Internet Explorer.
Tried all solutions posted on the codeigniter forums but nothing works.
Tried all solutions posted on the codeigniter forums but nothing works
Sadly I haven't got a couple weeks to trawl through "all solutions posted on codeigniter forums" and even then it would be a waste of time since any worthwhile answer to the problem would describe how to diagnose the specific problem, not just how to fix it; I have access to your systems to run diagnostics myself.
Get hold of iehttpheaders or wireshark and check what's happening to the session cookies.
And do make some time to read this article
C.
I did only one config change that I just saw in another post in StackOverFlow and it totally worked for me.
You need to change your config file
from this:
$config['sess_cookie_name'] = 'ci_session';
to:
$config['sess_cookie_name'] = 'cisession';
and that's it, hope it helps!