- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
function IPtoDWORD(const s: string):DWORD;
var
L: TStringList;
b: packed array [0..3] of byte;
i: Integer;
begin
Result := 0;
L := TStringList.Create;
try
L.Delimiter := '.';
L.DelimitedText := s;
for i := 0 to 3 do
b[3 - i] := StrToInt(L[i]);
Result := pdword(@b[0])^;
finally
L.Free
end;
end;
...
if (NewIP >= IPtoDWORD('192.168.0.0')) and (NewIP <= IPtoDWORD('192.168.0.255')) then
//Пускаем
else
ServerSocket.Socket.Connections[i - 1].SendText('запрет'); //Запрет
ServerSocket.Socket.Connections[i - 1].Close; //Закрываем канал
if (NewIP >= IPtoDWORD('193.168.0.0')) and (NewIP <= IPtoDWORD('193.168.0.255')) then
//Пускаем
if (NewIP >= IPtoDWORD('194.168.0.0')) and (NewIP <= IPtoDWORD('194.168.0.255')) then
//Пускаем
if (NewIP >= IPtoDWORD('195.168.0.0')) and (NewIP <= IPtoDWORD('195.168.0.255')) then
//Пускаем