function autoDiscovery($lower, $upper)
{
    $genericSnmpPath = $_SERVER["DOCUMENT_ROOT"] . "/vanguardhe/php_scripts/oidget/genericSnmp.php";
    require_once $genericSnmpPath;
    // to initialize snmp
    // to do: 1) get all of ip into a list
    // 2) iterator over the ip list, and check the pingable.
    //3) in the pingable list, use public/PUBLIC, if has something, restore to the datasa
    $reachableIpList = getAllOnlineDevice(getAllIp($lower, $upper));
    //$reachableIpList = getAllIp($lower, $upper);
    for ($i = 0; $i < sizeof($reachableIpList); $i++) {
        # code...
        $o = snmpget_smallp($reachableIpList[$i], ".1.3.6.1.2.1.1.2.0");
        // oid
        $comm = "public";
        if (substr($o, 0, 2) == "No") {
            # code...
            $o = snmpget_bigP($reachableIpList[$i], ".1.3.6.1.2.1.1.2.0");
            // oid
            $comm = "PUBLIC";
        }
        if (substr($o, 0, 2) != "No") {
            # code...
            writeToDatabase($reachableIpList[$i], $comm);
            echo $reachableIpList[$i] . " : " . $comm . " has been added into the database.<br>";
        }
    }
}
Beispiel #2
0
    }
    if ($county != "") {
        writeToDatabase('county', $county, $uuid);
    }
    if ($country != "") {
        writeToDatabase('country', $country, $uuid);
    }
    writeToDatabase('postcode', $postcode, $uuid);
    if ($registerType != "") {
        writeToDatabase('register_type', $registerType, $uuid);
    }
    if ($thirdPartyUid != "") {
        writeToDatabase('third_party_uid', $thirdPartyUid, $uuid);
    }
    if ($dateOfBirth != "") {
        writeToDatabase("date_of_birth", $dateOfBirth, $uuid);
    }
    if ($json_code != 8) {
        $json_code = 1000;
        $json_message = "Update personal information(include nickname)";
    }
} else {
    $json_code = 5;
    $json_message = "User id is not found";
}
mysql_close();
function writeToDatabase($databaseItem, $varable, $uuid)
{
    include "connectDB.php";
    $tbl_name = "userinfo";
    // Table name