Tag: PHP

OS判別

  • 怪しいスクリプトから抜粋
    <?php
    $arch = 64;
    if (intval("9223372036854775807") == 2147483647)
        $arch = 32;
    print "Arch is ".$arch."\n";
    $f = fopen("/usr/bin/host", "rb");
    if ($f) {
        $n = unpack("C*", fread($f, 8));
        print "System is ".($n[8] == 9 ? "FreeBSD" : "Linux")."\n";
        fclose($f);
    }

Last-modified: 2014-03-18 (火) 10:28:43 (1255d)