carrera Posted May 24, 2016 Posted May 24, 2016 Hello, I see TUniServerModule has "BlockedIPList" Property but i don't know how to set value to filter specific ip range. ex. if i want to allow only IP: 111.222.*.* (ip begin with 111.222) to access my site how should i have to set in BlockedIPList property ? Thank you Quote
bugra Posted May 24, 2016 Posted May 24, 2016 Hi; You can do it with code in ServerModule Create event Add this procedure TUniServerModule.UniGUIServerModuleCreate(Sender: TObject); var IPThird,IPFourth: Integer; IPThirdString, IPFourthString,IP: string; begin for IPThird := 0 to 255 do begin IPThirdString := CheckStrLength(inttostr(IPThird)); for IPFourth := 0 to 255 do begin IPFourthString := CheckStrLength(inttostr(IPFourth)); IP := '111.222.'+IPThirdString+'.'+IPFourthString; BlockedIPList.Append(IP); end; end; end; and for CheckStrLength function create private function same name in serverModule private function CheckStrLength(Str:string):string; and write function function TUniServerModule.CheckStrLength(Str: string): string; begin if Length(Str)=2 then Result := '0'+Str else if Length(Str)=1 then Result := '00'+Str else Result := Str; end; 2 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.