Attribute VB_Name = "modfunc"
Public NotificationStyle As String
Public Function GetCountry() As String

GetCountry = Frmain.country.text
End Function

Public Function GetFlag(sCountry As String) As Integer

sCountry = Frmain.country.text
Select Case (sCountry)
 
    Case "ae":
        GetFlag = 1
    Case "an":
        GetFlag = 2
    Case "ao":
        GetFlag = 3
    Case "ar":
        GetFlag = 4
    Case "au":
        GetFlag = 5
    Case "ba":
        GetFlag = 6
    Case "be":
        GetFlag = 7
     Case "bh":
        GetFlag = 8
       Case "bo":
        GetFlag = 9
    Case "br":
        GetFlag = 10
     Case "by":
        GetFlag = 11
    
    Case "ca":
        GetFlag = 12
        Case "cg":
        GetFlag = 13
    Case "sz":
        GetFlag = 14
    Case "ci":
        GetFlag = 15
   
    Case "cl":
        GetFlag = 16
    Case "cm":
        GetFlag = 17
    Case "cn":
        GetFlag = 18
    Case "Colombia":
        GetFlag = 19
       Case "cu":
        GetFlag = 20
       Case "cz":
        GetFlag = 21
    Case "de":
        GetFlag = 22
    
    Case "dk":
        GetFlag = 23
   
    Case "dz":
        GetFlag = 24
    Case "ec":
        GetFlag = 25
   
    Case "eg":
        GetFlag = 26
    
    Case "es":
        GetFlag = 27
   
    Case "fi":
        GetFlag = 28
   
    Case "fr":
        GetFlag = 29
    Case "ga":
        GetFlag = 30
    Case "uk":
        GetFlag = 31
   
    Case "Ggh":
        GetFlag = 32
    
    Case "gr":
        GetFlag = 33
 
    Case "hk":
        GetFlag = 34
   
    Case "hr":
        GetFlag = 35
   
    Case "hu":
        GetFlag = 36
    Case "id":
        GetFlag = 37
    Case "ie":
        GetFlag = 38
    Case "il":
        GetFlag = 39
    
    Case "in":
        GetFlag = 40
 
    Case "iq":
        GetFlag = 41
    Case "ir"
        GetFlag = 42
    Case "is":
        GetFlag = 43
    Case "it":
        GetFlag = 44
    
    Case "jm":
        GetFlag = 45
    Case "jo":
        GetFlag = 46
    Case "jp":
        GetFlag = 47
   
    Case "kp:"
        GetFlag = 48
    Case "kr":
        GetFlag = 49
    Case "kw":
        GetFlag = 50
   
    Case "lb":
        GetFlag = 51
    Case "lu":
        GetFlag = 55
   
    Case "ly":
        GetFlag = 56
    Case "ma":
        GetFlag = 57
   
    Case "mx":
        GetFlag = 58
    Case "my":
        GetFlag = 59
    Case "mz":
        GetFlag = 60
    Case "na":
        GetFlag = 61
   
    Case "ne":
        GetFlag = 62
    Case "ng":
        GetFlag = 63
    Case "an":
        GetFlag = 64
    Case "no":
        GetFlag = 65
   
    Case "nz":
        GetFlag = 66
    Case "om":
        GetFlag = 67
   
    Case "pe":
        GetFlag = 68
  
    Case "ph":
        GetFlag = 69
    Case "pk":
        GetFlag = 70
    Case "pl":
        GetFlag = 71
    Case "ps":
        GetFlag = 72
    Case "pt":
        GetFlag = 73
    Case "qa":
        GetFlag = 74
    Case "ro":
        GetFlag = 75
    Case "Serbia":
        GetFlag = 76
    Case "ru":
        GetFlag = 77
    Case "sa":
        GetFlag = 78
    Case "sd":
        GetFlag = 79
    Case "se":
        GetFlag = 80
    Case "sl":
        GetFlag = 81
    Case "sk":
        GetFlag = 82
    Case "sn":
        GetFlag = 83
    Case "sy":
        GetFlag = 84
    Case "sz":
        GetFlag = 85
    Case "tc":
        GetFlag = 86
    Case "th":
        GetFlag = 87
    Case "tn":
        GetFlag = 88
    Case "tr":
        GetFlag = 89
    Case "tw":
        GetFlag = 90
    Case "tz":
        GetFlag = 91
    Case "ua":
        GetFlag = 92
    Case "us":
        GetFlag = 93
    Case "uy":
        GetFlag = 94
    Case "ve":
        GetFlag = 95
    Case "ye":
        GetFlag = 96
    Case "za":
        GetFlag = 97
    Case "zm":
        GetFlag = 98
    Case "zw":
        GetFlag = 99
   Case "bo"
       GetFlag = 108
       Case "do"
       GetFlag = 101
       Case "hn"
       GetFlag = 102
        Case "ru"
       GetFlag = 103
        Case "rs"
       GetFlag = 105
        Case "mk"
       GetFlag = 200
    Case Else
       GetFlag = 109
End Select
        
End Function
Public Function Findip(strResponse As String) As String
Findip = Blondje(strResponse, "</form><hr>([^<]+)<")
End Function

Function Blondje(text, Pattern) As String
Dim Regex As RegExp
Dim Matches As Variant
Set Regex = New RegExp
Regex.Pattern = Pattern
Set Matches = Regex.Execute(text)
If Matches.Count = 0 Then
Blondje = ""
Exit Function
End If
Blondje = Matches(0).SubMatches(0)
End Function

Public Function GetVlag(IP As String) As String
Dim http As WinHttpRequest
Dim strSettings As String
Dim strURL As String
Dim strPostData As String
Dim strHeader As String
Dim strResponse As String
Dim ipflag As String
strSettings = "No"
strPostData = "ip_check=" & IP & "&check=Check"
strURL = "http://ip2country.hackers.lv/"
Set http = New WinHttpRequest
http.Open "POST", strURL, False
http.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
http.Send strPostData
strResponse = http.ResponseText
ipflag = Findip(strResponse)
Dim Ik() As String
Dim Vlag As String
Ik = Split(ipflag, ",")
GetVlag = LCase(Mid(Ik(1), 15, 2))
End Function

