MaVRoSCy
MaVRoSCy

Reputation: 17839

How to get ip address by session in Joomla using sql

Is there any way that I could get the session's ip address in my Joomla website using sql?

As I can see in the session table I only have session_id, client_id, guest, time, data, userid, username.

Is there anyway that I could extract also the IP address of user that has an open session on my website?

Please note that i cannot use JFactory::getSession()->get(...) or any other PHP code. I can only access my server's sql database.

Upvotes: 0

Views: 1550

Answers (1)

Lodder
Lodder

Reputation: 19733

You could set a custom session variable in Joomla like so:

$ip = $_SERVER['REMOTE_ADDR'];

$session = JFactory::getSession();
$session->set('ip', $ip);

Update:

Use the following to get the IP instead of $_SERVER['REMOTE_ADDR'];

https://joomla.stackexchange.com/a/15989/168

Upvotes: 1

Related Questions