Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> poprawność adresu ipv4
tomekp
post
Post #1





Grupa: Zarejestrowani
Postów: 171
Pomógł: 0
Dołączył: 17.12.2003
Skąd: Krakół

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


W jaki sposób można sprawdzić czy podany w formularzu adres IPv4 jest poprawny?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
tomekp
post
Post #2





Grupa: Zarejestrowani
Postów: 171
Pomógł: 0
Dołączył: 17.12.2003
Skąd: Krakół

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


Wynalazłem coś takiego z poweradmin'a
  1. <?php
  2. /*
  3.  * Validates an IPv4 IP.
  4.  * returns true if valid.
  5.  */
  6. function is_valid_ip($ip) {
  7. // Stop reading at this point. Scroll down to the next function...
  8. // Ok... you didn't stop reading... now you have to rewrite the whole function! enjoy;-)
  9. // Trance unborked it. Twice even!
  10. return ($ip == long2ip(ip2long($ip))) ? true : false;
  11.  
  12. }
  13. ?>


Ten post edytował tomekp 29.04.2006, 15:11:11
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 16.10.2025 - 12:10