IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası

IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası (https://www.ircforumlari.net/)
-   Visual Basic (https://www.ircforumlari.net/visual-basic/)
-   -   IP Doğrulama (https://www.ircforumlari.net/visual-basic/124746-ip-dogrulama.html)

Cemalizim 21 Temmuz 2008 18:39

IP Doğrulama
 
PHP- Kodu:

'Projenize 1 adet metin kutusu ve bir adet buton ekleyin

Public Function Valid_IP(IP As String) As Boolean
    Dim i As Integer
    Dim dot_count As Integer
    Dim test_octet As String
    Dim byte_check
     IP = Trim$(IP)

     ' 
make sure the IP long enough before
     
' continuing
     If Len(IP) < 8 Then
        Valid_IP = False
        '
Show Message
        MsgBox IP 
" is Invalid", , "IP Validator"
        
Exit Function
    
End If

    
1
    dot_count 
0
    
For 1 To Len(IP)
        If 
Mid$(IPi1) = "." Then
            
' increment the dot count and
            ' 
clear the test octet variable
            dot_count 
dot_count 1
            test_octet 
""
            
If Len(IPThen
                
' we've ended with a dot
                
' this is not good
                Valid_IP = False
                '
Show Message
                MsgBox IP 
" is Invalid", , "IP Validator"
                
Exit Function
            
End If
        Else
            
test_octet test_octet Mid$(IPi1)
            
On Error Resume Next
            byte_check 
CByte(test_octet)
            If (
ErrThen
                
' either the value is not numeric
                ' 
or exceeds the range of the byte
                
' data type.
                Valid_IP = False
                Exit Function
            End If
        End If
    Next i
     ' 
so farso good
      
' did we get the correct number of dots?
    If dot_count <> 3 Then
        Valid_IP = False
        Exit Function
    End If
     ' 
we have a valid IP format!
    
Valid_IP True
        
'Show Message
        MsgBox IP & " is Valid", , "IP Validator"
    
End Function

Private Sub Command1_Click()
    If Len(Text1) = 0 Then
        MsgBox "Please type an IP Address in the textbox.", , "IP Validator"
    Else
        '
Call the Function
        
Valid_IP Text1
    End 
If
End Sub 

Alıntıdır


Tüm Zamanlar GMT +3 Olarak Ayarlanmış. Şuanki Zaman: 05:33.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO
Copyright ©2004 - 2025 IRCForumlari.Net Sparhawk