![]() |
Capturing IP Address & Session in Log File - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Capturing IP Address & Session in Log File (/showthread.php?tid=88605) |
Capturing IP Address & Session in Log File - mikestratton - 10-04-2023 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'], RE: Capturing IP Address & Session in Log File - InsiteFX - 10-04-2023 If the user is behind a Proxy Server you will have trouble getting their IP Address. |