Bunkertor 7 Posted May 18, 2007 Report Share Posted May 18, 2007 Sveiki. Atkal viens beernudaarza jautaajums, bet kameer mani veel nebano, centiishos paspeet :) Rakstu statistikas skriptu, bet shis taa vietaa, lai nemtu klienta IP adresi, nem mana webservera IP adresi. Piemeers saiisinaataa formaa. Nav veerts visu rakstiit, jo paareejais viss straadaa. Negribeetos ticeet, ka tas ir tikai taapeec, ka testeeju skriptu uz taa dumaa Windows servera... ... $timestamp = time(); $client_ip = addslashes($_SERVER['REMOTE_ADDR']); $query = "INSERT INTO $stat_table ( timestamp, ip, ) VALUES ( '$timestamp', '$client_ip', );"; $result = mysql_query($query, $db); ?> paldies... Link to comment Share on other sites More sharing options...
andrisp Posted May 18, 2007 Report Share Posted May 18, 2007 (edited) $_SERVER['REMOTE_ADDR'] pavisam noteikti nevar saturēt web servera adresi. Ja nu vienīgi tu never saitu vaļā no tā paša kompja, kur web serveris tusējas. Bet tad parasti arī ir 127.0.0.1. Edited May 18, 2007 by andrisp Link to comment Share on other sites More sharing options...
Bunkertor 7 Posted May 18, 2007 Author Report Share Posted May 18, 2007 Un tomeer outputaa visas rindinjas izskataas shaadi Date |IP | Page | Referrer 18/05/07, 3:16 pm | xxx.xxx.200.196 |/welcome.html | www.google.com Un tas IP tochno ir mans serveris. Mistika! Link to comment Share on other sites More sharing options...
march Posted May 18, 2007 Report Share Posted May 18, 2007 (edited) Ja tu to lapu atver no tā datora, kur atrodas serveris, tad protams ka sakritīs servera ip un tava kā klienta ip. Arī tad ja tu lapu ver caur pilno adresi, nevis caur localhost. Edited May 18, 2007 by march Link to comment Share on other sites More sharing options...
Bunkertor 7 Posted May 18, 2007 Author Report Share Posted May 18, 2007 Ja tu to lapu atver no tā datora (vai no viena iekšējā tīkla), kur atrodas serveris, tad protams ka sakritīs servera ip un tava kā klienta ip. Nu jaa, bet to lapu apmeklee arii keksi no USA, UK un citaam valstiim. Man paarbaudes peec staav arii "extreme" counteris, lai vareetu noveerteet, cik preciizs ir mans skripts. Es dienaa sanjemu hitus no apm 200 juuzeriem, bet skripts visus ieraksta ar manu IP, neatkariigi no taa, kuraa pasaules malaa seezh juuzers. Link to comment Share on other sites More sharing options...
andrisp Posted May 18, 2007 Report Share Posted May 18, 2007 Pameklē skriptos vai tev kaut kur neoverwraitojas tas $_SERVER['REMOTE_ADDR']. Bet vispaar izskataas peec tiikla vai servera konfiguraacijas vainas. Ja tu uztaisi pliku html failu ar echo $_SERVER['REMOTE_ADDR'], tad arii visu laiku servera ip paraadaas ? Link to comment Share on other sites More sharing options...
Bunkertor 7 Posted May 18, 2007 Author Report Share Posted May 18, 2007 Pameklē skriptos vai tev kaut kur neoverwraitojas tas $_SERVER['REMOTE_ADDR']. Bet vispaar izskataas peec tiikla vai servera konfiguraacijas vainas. Ja tu uztaisi pliku html failu ar echo $_SERVER['REMOTE_ADDR'], tad arii visu laiku servera ip paraadaas ? Jaa, plikais fails raada servera IP, iegaaju otraa telpaa, kur kompiitim cita IP un atkal plikais raada servera IP. Laikam Tev taisniiba, vainiigs tas windows servaks. Riit ieliidiishu savaa vecajaa UNIXaa, ja uz taa arii nestraadaas, tad es pat nezinu... Nu labi, lai iet viss skripts. Varbuut kaadam var nodereet no viedoklja kaa nevajag dariit :D <?PHP $stat_table = "terra"; $req_uri = addslashes($_SERVER['REQUEST_URI']); $referer = addslashes($_SERVER['HTTP_REFERER']); $remote_addr = addslashes($_SERVER['REMOTE_ADDR']); $http_user_agent = addslashes($_SERVER['HTTP_USER_AGENT']); $timestamp = time(); $query = "INSERT INTO $stat_table ( timestamp, ip, page, referer, browser, ) VALUES ( '$timestamp', '$remote_addr', '$req_uri', '$referer', '$http_user_agent', );"; $result = mysql_query($query, $db); ?> Link to comment Share on other sites More sharing options...
Recommended Posts