testip.php 300 B

1234567891011
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * @package chamilo.webservices
  5. */
  6. $ip = trim($_SERVER['REMOTE_ADDR']);
  7. if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
  8. list($ip1, $ip2) = preg_split('/,/', $_SERVER['HTTP_X_FORWARDED_FOR']);
  9. $ip = trim($ip1);
  10. }
  11. echo htmlentities($ip);