1 // Final Method 2 3 4 5 Public Static Bool Getadminloginip ( String Loginip) 6 { 7 List <mastermodel> List = Null ; 8 List = (list <mastermodel> ) Utility. makecacheall [common. Constraints. c_adminuserloginip]; 9 If (List! = Null ) 10 { 11 Foreach (Mastermodel Model In List) 12 { 13 If (Model. Name = " *.*.*.* " ) // Allow all IP addresses 14 { 15 Return True ; 16 } 17 Else If (Model. Name = loginip) // Allow the current IP address to exist. 18 { 19 Return True ; 20 } 21 Else // Start matching IP Address 22 { 23 Int Flag = 0 ; // The default value is 0 when the number of successful matches starts. 24 String [] Loginiparray = loginip. Split ( ' . ' ); // Logon IP Address 25 String [] Strip = model. Name. Split ( ' . ' ); // Allow IP 26 For ( Int I = 0 ; I < 4 ; I ++ ) 27 { 28 If (Strip [I]! = " * " ) 29 { 30 If (Strip [I] = Loginiparray [I]) 31 { 32 Flag + = 1 ; // If the IP address segment matches successfully, the number of matches increases by 1. 33 } 34 Else 35 { 36 Flag = 0 ; // The number of matching failures is 0 and the current loop exists. 37 Break ; 38 } 39 } 40 Else 41 { 42 Flag + = 1 ; // * The number of successful matches + 1 by default 43 } 44 } 45 If (Flag = 4 ) // Matched 46 { 47 Return True ; 48 } 49 // Else 50 // { 51 // Continue; // Jump out of the current loop and perform the next loop 52 // } 53 } 54 } 55 Return False ; 56 } 57 Return False ; 58 }