Set cache for each user in CodeIgniter - codeigniter

I using CodeIgniter 3.1.5 which each user can register and login in own his profile, I have user_id in session, I want using cache (web cache, or cache driver not different) for each one And I don't want using query_string, how can create cache file for each user ?

Related

Managing users sessions by laravel authentication mechanism

first of all im new in Laravel and i used Codeigniter before...
Users in my project have one session for each system they logged in to and each session has its own token.
sessions are stored in sessions table and sessions table is related to users table for retrieving the users informations by token
User token and authentication is written by me and I do not use Laravel authentication system because I recently transferred my project from Codeigniter to Laravel.
so how can i manage this sessions and token generation with laravel authenticating system ?

System.Runtime.Caching.MemoryCache be persist for application across users in production

I have created a webapi2 app with angular2 application and angular service call to webapi , if webapi is got down , have to load the data from cache and the cache is expire after 20 minutes.
I am using Memory cache to cache the data in webapi. It is working fine in local application.
While moving to iis in production, it will be available for all the users or only available for the particular user.
It is a home page of the app, they don't have authentication. so everyone can see the page.
Else
Which mechanism of cache will work in the above scenario?
Output cache -or Memory cache or any other caching strategy for webapi2.
About Caching in webapi
when you cache data in a web application, which get cached for that application i.e. which is kind of a common data public to all, ie) means when you cache that cache data is available to each request you make to your application, which in turn available to all users in the application.
One thing you can do is create cache type you want but, put [Authrized] attribute on the method which is providing cache data, it allowed to access cache to only those users who are logged in your application.
I have created and use a file-based Caching in WebAPI, advantage is , it gets expire when file gets modified so there is no query database till file get modified, Now question to when to modify file: I modify the file when there is insert, update, delete done on the data which I am caching.

Facing Cakephp session issue

I am using cakephp 2x and facing issues with cakephp session.
And the flow of website is like whenever you register successfully its auto logged-in and redirects to home page.
Here I am using data from cake session like:
$this->Session->read('Auth.Front');
But it returns different values on register and on login.
So how to debug it ? from where its writing session 'Auth.Front' ?
AuthComponent is surely overwriting the Auth key with the user data. Try using a different key.
This should work:
$this->Session->write('Front',$myData);
$myData=$this->Session->read('Front');

how to view user data in codeigniter using 3 times log out my data is not visible

I'm new in PHP and Codeigniter, by the way how to update database table when session in CI is expired and where I can put the code? I use uniqid in database, it's called token. here is my login tableusername, password, level, token, last_login, exp_time. and I want to change value token=null when session in Codeigniter is expired.
I think you're approaching this the wrong way. Sessions can expire passively, so your user DB would not be up to date.
You could use Codeigniter's option to store session data in your MySQL database and check against those entries.

symfony 1.4 session without using cookies

I have a Symfony application which use a mysql database to store session data, and uses the SfGuard plugin to manage the authentication.
Despite that symfony allways save the authentication info in a cookie. Is there anyway i can disable cookies and store the authentication info in the database or in memory?
I might need in the future, to have a kind of single sign on feature, where the authentication state will persist between multiple applications, in different domains. Thats why I mostly want to eliminate the need to use cookies.
Thank you for your help.
You do not seem to understand how sessions work.
That cookie that gets sent to the cient is called the session id, and it's unique to the visitor. When he reqests a page from the server that cookie identifies the row in your session table where his data are - no data besides the ID is ever sent to the client.
Without that ID there's no way to pair a request to session data, that's why you could not log in anymore after disabling the cookies. The alternative to the cookie is to pass the session id some other way, like in the url - php can do that automatically, you just need to enable use_trans_sid in the php.ini.
Yes, you can store the authentication info in the database : See here how.

Resources