About the author
I implemented a simple IP address banning system in one of my Web Services.
In the Web Services code, this is what I had to do.
var WebModule: TWebModule; Request: TWebRequest; TempIP, IP: string; IPNetwork: TIdNetworkCalculator; Banned1, Banned2: Boolean;begin WebModule := GetSOAPWebModule; Request := WebModule.Request; IP := Request.GetFieldByName('HTTP_X_FORWARDED_FOR'); if IP = '' then IP := Request.RemoteAddr; IPNetwork := TIdNetworkCalculator.Create(nil); try while Length(IP)>0 do begin TempIP := Fetch(IP, ', '); IPNetwork.NetworkAddress.AsString := '202.12.94.0'; IPNetwork.NetworkMaskLength := 23; Banned1 := IPNetwork.IsAddressInNetwork(TempIP);
IPNetwork.NetworkAddress.AsString := '172.16.0.0'; IPNetwork.NetworkMaskLength := 12; Banned2 := IPNetwork.IsAddressInNetwork(TempIP); if Banned1 or Banned2 then raise ERemotableException.Create('Your domain address is banned.'); end; finally IPNetwork.Free; end;end;
Learn why the map is cool in Go!
A method to design records so that they're allocated on a specific byte boundary, such as 16 bytes, 512 bytes, 4096 bytes, etc.
Learn the command line used to compile System.pas in Delphi
How to free more space on your home drive by redirecting the location for SDKs in RAD Studio