ASP ile bazı değerlerin validate edilmesi bazen zor olabilir. Her değerin validate edilebilmesi için de farklı fonksiyonlar ve kurgular gerekebiliyor. Bunun için bir IP Validate fonksiyonu hazırladım. Buyrun kullanın
size true yada false olarak dönecektir.
ValidateIP("192.168.2.1")
ValidateIP(gelen_ip)
Function ValidateIP(GelenIp)
' ////////////////////////////////////////
' IP Block Validate Function For C.Asp //
' Written By Anthony Burak DURSUN //
' (c) 2013 | www.burakdursun.com //
' badursun@gmail.com //
' ////////////////////////////////////////
TotalScore = 0
GelenIp = Trim(GelenIp)
If Instr(GelenIp, ".") = 0 Then
ValidateIP = False
Exit Function
Else
Parcala = Split(GelenIp, ".")
ToplamParca = Ubound(Parcala)
If ToplamParca = 3 Then
For IPValCount = 0 To UBound(Parcala)
str_dimsel_part = Parcala(IPValCount)
If isNull(str_dimsel_part) Or IsEmpty(str_dimsel_part) Or Not IsNumeric(str_dimsel_part) Or str_dimsel_part = "" Then
ValidateIP = False
Exit Function
End If
str_dimsel_part = Int(str_dimsel_part)
if str_dimsel_part > 0 or str_dimsel_part < 255 Then
TotalScore = TotalScore + 1
Else
ValidateIP = False
Exit Function
End If
Next
If TotalScore = 4 Then
ValidateIP = True
Exit Function
Else
ValidateIP = False
Exit Function
End If
Else
ValidateIP = False
Exit Function
End If
End If
End Function
Benzer fonksiyonları hazırladıkça ekleyeceğim.