[Solar-talk] Solar::server('REMOTE_ADDR')
Antti Holvikari
anttih at gmail.com
Sat Sep 23 03:22:03 PDT 2006
On 9/23/06, Jeff Surgeson <solar at 3hex.com> wrote:
> Hi Guys, blonde question
>
> I would normaly use Solar::server('REMOTE_ADDR') to obtain a remote ip address
> to set up a default values in my data model, this method is obviously no
> longer available with new request class.
>
> I have created a simple method in my data model to replace this...
>
> public function remoteAdd()
> {
> $request = Solar::factory('Solar_Request');
> return $request->server('REMOTE_ADDR');
> }
>
> Other than creating a seperate method as above in my data model to set up a
> request object and retrieve remote address is there a simple one liner to
> refer to it? In your app you can refer to $this->_request->server() or get()
> or post() etc etc, but this is obiously not available in the data model.
>
> What am I missing?
I don't exactly have an answer to your question but what I would do is
to use that $this->_request->server('REMOTE_ADDR') in my controller
and pass that as a param to the model object. That is, I try to
prevent using superglobals in my models. There are some exceptions
ofcourse... :-)
Sorry if this didn't help to solve your problem.
--
Antti Holvikari <http://phphalo.com>
More information about the solar-talk
mailing list