note 29836 modified in function.exec by danbrown

From: Date: Sun, 04 Jan 2009 16:36:46 +0000
Subject: note 29836 modified in function.exec by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-148818@lists.php.net to get a copy of this message
I wrote a simple ping user function, useful for automatically determining wether to show high bandwidth content or calculating download times. <?php function PingUser() { global $REMOTE_ADDR; return ereg_replace(" ms","",end(explode("/",exec("ping -q -c 1 $REMOTE_ADDR")))); } ?> It returns a number representing the milli seconds it took to send and receive packets from the user. --was-- I wrote a simple ping user function, useful for automatically determining wether to show high bandwidth content or calculating download times. function PingUser() { global $REMOTE_ADDR; return ereg_replace(" ms","",end(explode("/",exec("ping -q -c 1 $REMOTE_ADDR")))); } It returns a number representing the milli seconds it took to send and receive packets from the user. http://php.net/manual/en/function.exec.php

« previous php.notes (#148818) next »