[eluser]leighmarble[/eluser]
I have a website that autoloads the session class (and also saves session data to database), so all visitors to the site get session data stored for them.
So, in order to get any visitor's IP address, I could either do this:
Code:
$ip = $this->session->userdata('ip_address');
Or this:
Code:
$ip = $this->input->ip_address();
Is there an advantage of one over the other? In some brief iterative testing I've done, the input class method sometimes runs a bit faster. And, I suppose, if someone was blocking cookies with their browser settings, then session->userdata would be useless.
So, that would tell me that I'd pretty much always want to use the input class method. Any persuasive arguments in favor of using the session class for this?
Thanks,
Leigh