掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
ipアドレスが正しいかどうかを判定するには? (ID:29194)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
修正 function isSafeIP(IP:String):Boolean; var I,J,J2,K : Integer; S : String; begin Result := True; if Pos('$',IP) = 0 then begin J := 0; for I:=0 to 3 do begin J2 := PosEx('.',IP,J+1); if J2<>0 then begin S := Copy(IP,J+1,J2-J-1); if Length(S) < 4 then begin K := StrToIntDef(S,256); end else begin Result := False; end; end; if (J2=0) then begin if I=3 then begin S := Copy(IP,J+1,Length(IP)-J); if Length(S) < 4 then begin K := StrToIntDef(S,256); end else begin Result := False; end; end else begin Result := False; end; end; if (K<0) or (255<K) then Result := False; J := J2; end; if Copy(IP,J,1) = '.' then Result := False; end else begin Result := False; end; end;
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.