Jump to content
php.lv forumi

Rāda IP adresi kā vārdu.


Cibiņš

Recommended Posts

Nini, nu chiniju savai lapai admin sisteemu - uztaisiju IP adreshu sekotaaju, kas fiksee IP adreses. Nu vot lieta tada ka pati lapa "nokjer un iebaazh" to IP adresi datubaazee. Savukaart admin sisteemaa atkal es redzu taas IP adreses, apmekletaas lapas utt. Kkas liidziigs statistikai kar4. Nu un lieta taada, ka es veletos lai admin sisteemaa esoshaa lapa izvelk IP adresi kaa vaardu - teiksim, ja datubaazee atrodas IP adrese 111.111.111.111, tad lai to IP adresi 111.111.111.111 vinjsh parada kaa Gunita. Ja datubaazee ir IP adrese 222.222.222.222, tad lapa admin sisteemaa paraada to IP adresi kaa Maartinjsh..Vaardu sakot admin sisteemaa esoshajaa lapaa noraadu zinaamos IP un pie taa pielieku vaardus, lai lapa raada nevis IP bet vaardu. kaukaa taa, nu ceru ka saprati.

Edited by MCWeb.lv
Link to comment
Share on other sites

Nu nevajag jau bazt vardu iekshaa bet lai velkot ara to IP adresi araditos tas vards. Katrai IP adresei ir jabut redzamai ieejottubaazees ar datubaazhu paarvaldiibas progu. Bet lapaa, kura velk aaraa taas IP adreses tur vajag kkaadu to f-ju likt if {ip adrese ir 111.111.111.111 echo Gunita} else {izvilkt vienkarshi IP adresi (ja ir nezinaama)}vai kaukaa taa bet nezinu kaa to pierakstiit ar funkciju komandaam lai viss notiek..

Edited by MCWeb.lv
Link to comment
Share on other sites

Nu bet tas ir tikai normāli, ja atbilstoši IP adresei būs (vai arī nebūs) tekstuāla vērtība.

 

$query_string = "SELECT name FROM ip_tabula WHERE ip=$ip ";

$query = mysql_query($query_string);

$result = mysql_fetch_array($query);

if($result)echo $result[0];

else

echo $ip;

 

 

un viss:)

Ja nebūs ierakstīta vērtība, izvadīs IP, bet ja būs, tad vārdu.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...