diff options
Diffstat (limited to 'src/SemanticScuttle/Model/RemoteUser.php')
-rw-r--r-- | src/SemanticScuttle/Model/RemoteUser.php | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/SemanticScuttle/Model/RemoteUser.php b/src/SemanticScuttle/Model/RemoteUser.php new file mode 100644 index 0000000..6d48e3a --- /dev/null +++ b/src/SemanticScuttle/Model/RemoteUser.php @@ -0,0 +1,48 @@ +<?php +/** + * SemanticScuttle - your social bookmark manager. + * + * PHP version 5. + * + * @category Bookmarking + * @package SemanticScuttle + * @author Benjamin Huynh-Kim-Bang <mensonge@users.sourceforge.net> + * @author Christian Weiske <cweiske@cweiske.de> + * @author Eric Dane <ericdane@users.sourceforge.net> + * @license GPL http://www.gnu.org/licenses/gpl.html + * @link http://sourceforge.net/projects/semanticscuttle + */ + +/** + * Remote User helper methods. + * + * @category Bookmarking + * @package SemanticScuttle + * @author Christian Weiske <cweiske@cweiske.de> + * @license GPL http://www.gnu.org/licenses/gpl.html + * @link http://sourceforge.net/projects/semanticscuttle + */ +class SemanticScuttle_Model_RemoteUser +{ + /** + * Returns the remote user's IP. + * + * @return string IP address. NULL if not found. + */ + public static function getIp() + { + $ip = null; + if (getenv('REMOTE_ADDR')) { + $ip = getenv('REMOTE_ADDR'); + } else if (getenv('HTTP_CLIENT_IP')) { + $ip = getenv('HTTP_CLIENT_IP'); + } else if (getenv('HTTP_X_FORWARDED_FOR')) { + $ip = getenv('HTTP_X_FORWARDED_FOR'); + } + + return $ip; + } + +} + +?>
\ No newline at end of file |