Devils666 Posted April 15, 2010 Report Share Posted April 15, 2010 (edited) sveiki, tātad es izmantoju šo skriptu IP noteikšanai: $ip_noteiksana = (isset($_SERVER['REMOTE_ADDR'])?$_SERVER['REMOTE_ADDR']:''). (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR']!='unknown'?' fwd '.$_SERVER['HTTP_X_FORWARDED_FOR']:''). (isset($_SERVER['HTTP_CLIENT_IP'])?' client_ip '.$_SERVER['HTTP_CLIENT_IP']:''). (isset($_SERVER['HTTP_VIA'])?' via '.$_SERVER['HTTP_VIA']:''); tas ir labakais variants? man viņu nepieciešams pārveidot, tā lai rādītu tikai pašu IP adresu, bez visiem fwd vai via, lai nebutu ta: xxx.xxx.xxx.xxx via 1.1 new-br bet gan: xxx.xxx.xxx.xxx kā varētu parvaidot, lai parāda galveno ip adresi, kas tiek noteikta... vienkārši negribu kaut ko lieku noņemt.. Edited April 15, 2010 by Devils666 Quote Link to comment Share on other sites More sharing options...
php newbie Posted April 15, 2010 Report Share Posted April 15, 2010 es šitādu izmantoju $ip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; Quote Link to comment Share on other sites More sharing options...
Devils666 Posted April 15, 2010 Author Report Share Posted April 15, 2010 izskatās īsi, vienkārši - tiesi ka vaig :) Quote Link to comment Share on other sites More sharing options...
Aleksejs Posted April 15, 2010 Report Share Posted April 15, 2010 Sanāk, ka reģistrēsi manu iekšējā tīkla IP adresi, ja eju caur proxy: 192.168.*.* 10.*.*.* Tev to vajag? + neviens man neliedz rakstīt zilus brīnumus tajā X_FORWARDED_FOR headerī... Un REMOTE_ADDR, kuru tik viegli vis nevar mainīt, Tu vispār atmetīsi... Quote Link to comment Share on other sites More sharing options...
php newbie Posted April 15, 2010 Report Share Posted April 15, 2010 tas i tad ja serveris atrodas aiz rutera Quote Link to comment Share on other sites More sharing options...
Devils666 Posted April 15, 2010 Author Report Share Posted April 15, 2010 Sanāk, ka reģistrēsi manu iekšējā tīkla IP adresi, ja eju caur proxy: 192.168.*.* 10.*.*.* Tev to vajag? + neviens man neliedz rakstīt zilus brīnumus tajā X_FORWARDED_FOR headerī... Un REMOTE_ADDR, kuru tik viegli vis nevar mainīt, Tu vispār atmetīsi... Hmm, nu es no ši tik labi nesaprotu, bet tāda gadījuma ko tu iesaki? Quote Link to comment Share on other sites More sharing options...
php newbie Posted April 15, 2010 Report Share Posted April 15, 2010 (edited) a tev serveris ir aiz proxy? hmm vai nu tam hostam ko izmantoju tā sasetapots, ka $_SERVER['REMOTE_ADDR'] satur iekšējo proxy ip Edited April 15, 2010 by php newbie Quote Link to comment Share on other sites More sharing options...
kirils Posted April 15, 2010 Report Share Posted April 15, 2010 echo($_SERVER['REMOTE_ADDR']); shis ir pareizais variants. Quote Link to comment Share on other sites More sharing options...
Devils666 Posted April 15, 2010 Author Report Share Posted April 15, 2010 izskatās gandriz pārak vienkārši, bet nu var jau pamēģināt Quote Link to comment Share on other sites More sharing options...
daGrevis Posted April 15, 2010 Report Share Posted April 15, 2010 echo $_SERVER['REMOTE_ADDR']; Lietotāja IP. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.