Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> adres IP
kuboljs
post 16.05.2005, 11:16:46
Post #1





Grupa: Zarejestrowani
Postów: 14
Pomógł: 0
Dołączył: 5.05.2005

Ostrzeżenie: (0%)
-----


jak pobrać adres IP użytkownika który wszedł na naszą stronę questionmark.gif
Go to the top of the page
+Quote Post
ikioloak
post 16.05.2005, 11:33:42
Post #2





Grupa: Zarejestrowani
Postów: 416
Pomógł: 0
Dołączył: 8.01.2004

Ostrzeżenie: (0%)
-----


  1. <?php
  2.  
  3. $_SERVER['REMOTE_ADDR'];
  4.  
  5. ?>
Go to the top of the page
+Quote Post
mike
post 16.05.2005, 11:58:54
Post #3





Grupa: Przyjaciele php.pl
Postów: 7 494
Pomógł: 302
Dołączył: 31.03.2004

Ostrzeżenie: (0%)
-----


  1. <?php
  2. function GetClientIP()
  3. {
  4. $ip = 0;
  5.  
  6. if( ! empty( $_SERVER[ 'HTTP_CLIENT_IP' ] ) )
  7. {
  8. $ip = $_SERVER[ 'HTTP_CLIENT_IP' ];
  9. }
  10.  
  11. if( ! empty( $_SERVER[ 'HTTP_X_FORWARDED_FOR' ] ) )
  12. {
  13. $ipList = explode( &#092;", \", $_SERVER[ 'HTTP_X_FORWARDED_FOR' ] );
  14. if( $ip )
  15. {
  16. array_unshift( $ipList, $ip );
  17. $ip = 0;
  18. }
  19. foreach( $ipList as $v )
  20. {
  21. if( ! eregi( &#092;"^(192.168|172.16|10|224|240|127|0.\", $v ) )
  22. {
  23. return $v;
  24. }
  25. }
  26. }
  27.  
  28. return $ip ? $ip : $_SERVER[ 'REMOTE_ADR' ];
  29. }
  30. ?>
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 29.06.2025 - 10:11