Re: Re[2]: [PHP-GTK] grabbing I.P. number

From: Date: Mon, 16 Jul 2001 15:10:00 +0000
Subject: Re: Re[2]: [PHP-GTK] grabbing I.P. number
References: 1  Groups: php.gtk 
Request: Send a blank email to php-gtk+get-2201@lists.php.net to get a copy of this message
You'll have to forget about this behaviour of accessing environment variables passed from the web server; you aren't running under any websever anymore. The socket extension in PHP mimics the unix socket systemcalls, mainly I'm talking about accept_connet() [ <= PHP 4.06] and socket_accept() [ CVS]. But it contrast to what the unix system call does (filling a structure containing the clients IP address) while looking at current CVS, socket_accept() (and accept_connect()) doesn't seem to return this information: /* {{{ proto resource socket_accept(resource socket) Accepts a connection on the listening socket fd */ PHP_FUNCTION(socket_accept) { zval **arg1; php_socket *php_sock; php_socket *new_sock; struct sockaddr_in sa; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) { WRONG_PARAM_COUNT; } ZEND_FETCH_RESOURCE(php_sock, php_socket *, arg1, -1, le_socket_name, le_socket); new_sock = accept_connect(php_sock, (struct sockaddr *) &sa); if(new_sock == NULL) { php_error(E_WARNING, "unable to accept connection [%d]: %s", errno, strerror(errno)); RETURN_FALSE } ZEND_REGISTER_RESOURCE(return_value, new_sock, le_socket); } /* }}} */ The information in 'struct sockaddr_in sa' would be the one you desire AFAIK. Maybe Sterling, listed as one of the authors, can comment more on this ? kind regards, Markus On Mon, Jul 16, 2001 at 04:36:39PM +0200, Jonas Delfs wrote : > Hi Robert > > > That's what I thought, but It keeps returning a null value. Any suggestions > > on how to get it to return the value? > > I'm not sure that $REMOTE_ADDR gets defined in PHP-Gtk, but maybe you'd forgot to > make $REMOTE_ADDR global in the function you maybe are working in? > > -- > Mvh. Jonas Delfs, http://delfs.dk > > > > > > -----Original Message----- > > From: Adam Rambousek [mailto:rambousek@volny.cz] > > Sent: Monday, July 16, 2001 8:51 AM > > To: Robert Abbate; php-gtk@lists.php.net > > Subject: Re[2]: [PHP-GTK] grabbing I.P. number > > > > > > in PHP - $REMOTE_ADDR > > > > > How can you grab the I.P. number of the client's computer...is there a > > > function which allows you to do this? > > > > -- > > Adam Rambousek > > email: rambousek@volny.cz PGP KeyID: 33BD6BAE ICQ: 47596279 > > www: http://adamovy.cestiny.cz > > http://hemzeni.poda.cz/matrix > > * World is shutting down in 5 minutes. Please, log out! > > > > > > -- > > PHP GTK Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-gtk-unsubscribe@lists.php.net > > For additional commands, e-mail: php-gtk-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > -- > PHP GTK Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-gtk-unsubscribe@lists.php.net > For additional commands, e-mail: php-gtk-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > -- Markus Fischer, http://guru.josefine.at/~mfischer/ EMail: mfischer@guru.josefine.at PGP Public Key: http://guru.josefine.at/~mfischer/C2272BD0.asc PGP Fingerprint: D3B0 DD4F E12B F911 3CE1 C2B5 D674 B445 C227 2BD0

« previous php.gtk (#2201) next »