Welcome Guest, Not a member yet? Register   Sign In
Capturing IP Address & Session in Log File
#1

(This post was last modified: 10-04-2023, 09:55 AM by mikestratton.)

I have created a custom handler that allows me to write logs to a database. Now I need to use that same logger to capture the user's IP address and Session related data in the database, as well. Suggestions, please?

To capture the IP Address:
$request = \Config\Services::request();
$request->getIPAddress(),

I was able to capture session data with: $_SESSION['username'],
$_SESSION['user_id'],
Reply
#2

If the user is behind a Proxy Server you will have trouble getting their IP Address.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB