How can i access laravel session using codeigniter 3? - laravel

I have application built using codeigniter 3, it is a module inside a laravel 8 framework, the laravel framework holds the login and register module, then when a user logged in, it will redirect to my module, but when i print native php $_SESSION it does not return any session from laravel.
I have changed the session configuration of laravel inside config/session then 'domain' => '.mydomain.com' but still no session is printed.
I tried to print $_COOKIE and it display ci_session and laravel_session ID.
PS: server Centos 7

Related

Voyager first login gives 419 Page Expired error

I've made a new installation of Voyager on XAMPP on Windows following the instructions at https://github.com/the-control-group/voyager
I forgot to install with dummy data so I added an admin user using php artisan voyager:admin me#mydomain.com --create however when I try to login I get the 419 | Page Expired error which I understand is usually an issue with Laravel sessions.
My versions are: Voyager v1.4 | Laravel v7.18 | PHP v7.3.2 | MySql v5.0.12
The following points maybe relevant:
If I look at the login page source code I don't see any reference to a csrf field.
Looking in the database the user exists in the user table, and I entered an email_verified_at date directly.
I notice there's no entry in the user_roles table. I don't know what minimum database entries are required to make it work.
I've checked that session files are being created in storage/framework/sessions/
There's no error log in storage/logs/
I set 'debug' => env('APP_DEBUG', true), in config/app.php (APP_DEBUG was already set to true in .env) and retried the login but not found any debug log file.
I'm new to Voyager and still learning Laravel. Any ideas please how to make it work please?
UPDATE:
After several refreshes of the login page I was able to login, but if I click any menu link it returns me to the login page.
UPDATE2:
Re-running the install with dummy data succeeded but it didn't alter the login session issue. However it works perfectly on another device, so it must be some kind of browser session issue particular to the one PC.
Incidentally running the install with dummy data did not add any entries in the user_roles table, but the admin role is assigned when viewed in the users screen (on my other device).
I was getting this same error, i was serving my app on 127.0.0.1:8000 and my SESSION_DOMAIN was set on localhost. Make Sure you SESSION_DOMAIN in your env is set to the actual domain the app is being served on. Theissue was fixed by running php artisan serve --port=80 and browing to localhost/admin to login

Access laravel 5.0 session values from drupal 7

I am trying to get access laravel 5.0 session values for drupal 7.
I have put a value into laravel session using session(['test' => 'Hello']); or Session::put('test', 'abc');. And then how can I get this value from laravel session in drupal 7?

how to connect two projects Laravel 4.2 and laravel 5.5?

i have a laravel 4.2 project that i want to connect it to laravel 5.5 project
Q1) how to login in the first and and authenticated to the second to so i don't have to login to the second
Q2)how to connect them to the same DB
Q3)let's say i'm in page X in laravel 4.2 and i want to direct it to Y in laravel 5.5 where i should write the route in laravel 4.2 or in 5.5 ?
at the end both of the projects are going to be on the same server and have the same domain if that is going to be helpful
Q1) how to login in the first and and authenticated to the second to so i don't have to login to the second
if the 2 webapp are in the same domain, it should not be an issue
especially if they use the same database.
Q2)how to connect them to the same DB
just use the same credentials and save it on each env file.
Q3)let's say i'm in page X in laravel 4.2 and i want to direct it to Y in laravel 5.5 where i should write the route in laravel 4.2 or in 5.5 ?
you can use the function route instead use the manual routing like
to('somepage-on-theother-laravel') this is a tedious work. So i want
to ask if why are you using the 2 webapp in the same domain instead of
just using 1 webapp framework. Im thinking that this laravel 4.2 is
the existing one and you're create a new one and you want to use the
laravel 5.5 right?
This is easy to do, just put both applications on the same server and link them using the same credentials in the .ENV file, don't forget you will also need to create Models in both apps so that both apps can use the tables.
As for the routes, you would need to add the routes & functions that can be called in each individual app.
So if the user clicks the URL for /link-to-4.2 you should have a route in 4.2:
Route::get('/link-to-4.2', 'index#controller');
and then in your 5.5 you should have a route for any URLs that direct to anything there. i.e: /link-to-5.5
Route::get('/link-to-5.5', 'index#controller');
this all being said, what is the justification for using 2 apps? I think there could be a number of security issues that might cause headaches, this will also likely be a real nightmare to manage moving forward.
I would strongely suggest that you just upgrade the 4.2 app to be 5.5.

How to use core php session value in laravel framework?

There are 2 projects:
Built in core php.[main project]
Built in laravel.
We are integrating laravel with php. In core php folder I am placing a laravel folder. In main project I am linking to laravel project by click on a particular link.
During login to the main project [core php], we are setting emailid into session.
I want that emailid session value in to laravel folders. how do I access that core php session value from laravel project folder.
Is it possible?
Example link click here
but still there is some issues in that as laravel not able to access session object data

Access codeigniter session on unity 3d

I have a website made with codeigniter but one of the php document its generated by unity to execute a web application ,the problem is that I have to access to a session data from codeigniter $this->session->set_userdata('logged_in);
but I can't access yo this data from the unity webplayer
I guess you are using CodeIgniter (CI) 2?
In CI 2 you cannot access the session through the superglobal $_SESSION. If you need to use the CI session library than you could do it by enabling session loggin in the database. Then from your unity application you can query the CI session table.
Otherwise you can use a native session library for CI 2, like this one: https://github.com/bcit-ci/CodeIgniter/wiki/Native-session. With a native session library you can access session data through the superglobal $_SESSION.
In CI 3 the session library has been rewritten and uses the superglobal $_SESSION again. So no need to use a third party native session library there.
please print $_SESSION to get all session variable and seeing your code, to access logged_in variable, please use it following.
$logged_in=$this->session->userdata('logged_in);
now $logged_in variable contain logged_in information, please check.

Resources