*jancis38* Posted May 3, 2007 Report Share Posted May 3, 2007 Tātad šāds skripts: <?php $IP=(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']:''); if ($_SERVER['SERVER_PORT']!=443) { $links = "http://". $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; } $entry_line = "IP: <b>$IP</b> - <a href=$links>$links</a><br>"; $fp = fopen("inc/viesi/ko dara online lietotāji.txt", "a"); fputs($fp, $entry_line); fclose($fp); ?> Ieraksta lietotāja IP adresi iekš ko dara online lietotāji.txt kr4 šādā veidā, piem.: IP: 127.0.0.1 - <a href=http://localhost>$links</a> vai ir iespējams izdarīt tā, lai IP: 127.0.0.1 netiek ierakstīts iekš ko dara online lietotāji.txt ? Link to comment Share on other sites More sharing options...
dmitriy Posted May 3, 2007 Report Share Posted May 3, 2007 (edited) ja, pievienojot IF <?php $IP=(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']:''); if ($_SERVER['SERVER_PORT']!=443) { $links = "http://". $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; } if ($IP != '127.0.0.1') { $entry_line = "IP: <b>$IP</b> - <a href=$links>$links</a><br>"; $fp = fopen("inc/viesi/ko dara online lietotāji.txt", "a"); fputs($fp, $entry_line); fclose($fp); } ?> Edited May 3, 2007 by dmitriy Link to comment Share on other sites More sharing options...
cucumber Posted May 3, 2007 Report Share Posted May 3, 2007 vai ari iznem ara $entry_line = "<a href=$links>$links</a><br>"; un vairs neraktis IP'us Link to comment Share on other sites More sharing options...
*jancis38* Posted May 3, 2007 Author Report Share Posted May 3, 2007 (edited) ok vis strādā, a kā es varu pievienot vairākas IP adreses? vai ari iznem ara $entry_line = "<a href=$links>$links</a><br>"; un vairs neraktis IP'us nē man wajag lai raksta, tikai vajag lai dažas nerakstītu! Edited May 3, 2007 by *jancis38* Link to comment Share on other sites More sharing options...
cucumber Posted May 3, 2007 Report Share Posted May 3, 2007 Vairak paskaidro ka tu to doma vairaks IP addreses. Pagaidam tev rakstas viss viena faila. Link to comment Share on other sites More sharing options...
*jancis38* Posted May 3, 2007 Author Report Share Posted May 3, 2007 nu jā, tas man ir tāds kā viesu saraksts, ja man nepatīk links, kurā lietotājs atrodas, tad es uzlieku banu, vnk ierakstu administrātoru IP adreses, lai tās neizkrīt webā! nu kr4 IP adreses kuras es negribu lai raksta iekš *.txt failā tās ir IP adreses kuras piedere mājaslapas administrātoriem! Link to comment Share on other sites More sharing options...
cucumber Posted May 3, 2007 Report Share Posted May 3, 2007 tad izveido kaut kadu massivu no bad ip , glaba tas faila vai baze, un tas skaties kads ip ja ir bad saraksta, tad nerakstam klat, ja nav tad rakstam. Link to comment Share on other sites More sharing options...
blackhalt Posted May 4, 2007 Report Share Posted May 4, 2007 http://lv.php.net/manual/en/function.in-array.php Link to comment Share on other sites More sharing options...
tmpjail Posted May 6, 2007 Report Share Posted May 6, 2007 (edited) papildinot bh, $dontcount = array('127.0.0.1', '127.0.0.2', ... ); if(!in_array($ip, $dontcount)){ ... } Edited May 6, 2007 by tmpjail Link to comment Share on other sites More sharing options...
Recommended Posts