當前位置: 首頁>>代碼示例>>PHP>>正文


PHP networking::checkIP方法代碼示例

本文整理匯總了PHP中networking::checkIP方法的典型用法代碼示例。如果您正苦於以下問題:PHP networking::checkIP方法的具體用法?PHP networking::checkIP怎麽用?PHP networking::checkIP使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在networking的用法示例。


在下文中一共展示了networking::checkIP方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: SaveAddress

function SaveAddress()
{
    $ip = new networking();
    $server = $_GET["address_server"];
    if (trim($server) == null) {
        echo "Host cannot be null!\n";
        return;
    }
    $adip = "{$_GET["addr_1"]}.{$_GET["addr_2"]}.{$_GET["addr_3"]}.{$_GET["addr_4"]}";
    if (!$ip->checkIP($adip)) {
        echo "IP {$adip}\nFailed";
        return;
    }
    $conf = new dnsmasq();
    $conf->array_address[$server] = $adip;
    writelogs("save {$server} {$adip}", __FUNCTION__, __FILE__);
    $conf->SaveConf();
}
開發者ID:,項目名稱:,代碼行數:18,代碼來源:

示例2: ipconfig_routes_add

function ipconfig_routes_add(){
	$user=new usersMenus();
	$tpl=new templates();
	$ERROR_NO_PRIVS=$tpl->javascript_parse_text("{ERROR_NO_PRIVS}");
	if(!$user->AsSystemAdministrator){echo $ERROR_NO_PRIVS;return;}
	$ip=new networking();
	$ip1="{$_GET["ip_1"]}.{$_GET["ip_2"]}.{$_GET["ip_3"]}.0";
	$mask="{$_GET["mask_1"]}.{$_GET["mask_2"]}.{$_GET["mask_3"]}.{$_GET["mask_4"]}";
	$gw="{$_GET["gw_1"]}.{$_GET["gw_2"]}.{$_GET["gw_3"]}.{$_GET["gw_4"]}";
	
	if(!$ip->checkIP($ip1)){echo "IP $ip1\nFailed";return;}
	if(!$ip->checkIP($mask)){echo "MASK $mask\nFailed";return;}
	if(!$ip->checkIP($gw)){echo "Gateway $gw\nFailed";return;}	
	$nic=new system_nic($_GET["nic"]);
	$nic->ROUTES[$ip1]=array("NETMASK"=>$mask,"GATEWAY"=>$gw);
	$nic->SaveNic();
	
}
開發者ID:rsd,項目名稱:artica-1.5,代碼行數:18,代碼來源:system.nic.edit.php

示例3: ipconfig_routes_add

function ipconfig_routes_add(){
	$user=new usersMenus();
	$tpl=new templates();
	$ERROR_NO_PRIVS=$tpl->javascript_parse_text("{ERROR_NO_PRIVS}");
	if(!$user->AsSystemAdministrator){echo $ERROR_NO_PRIVS;return;}
	$ip=new networking();

	$ip1=$_POST["route-network"];
	$mask=$_POST["route-mask"];
	$gw=$_POST["route-gateway"];
	
	if(!$ip->checkIP($ip1)){echo "IP $ip1\nFailed";return;}
	if(!$ip->checkIP($mask)){echo "MASK $mask\nFailed";return;}
	if(!$ip->checkIP($gw)){echo "Gateway $gw\nFailed";return;}	
	$nic=new system_nic($_POST["nic"]);
	writelogs("SaveNic:: {$_POST["nic"]} $ip1/$mask -> $gw",__FUNCTION__,__FILE__,__LINE__);
	$nic->ROUTES[$ip1]=array("NETMASK"=>$mask,"GATEWAY"=>$gw);
	$nic->SaveNic($_POST["nic"]);
	
}
開發者ID:brucewu16899,項目名稱:1.6.x,代碼行數:20,代碼來源:system.nic.edit.php

示例4: import_dnsmasq_perform

function import_dnsmasq_perform()
{
    $ip = new networking();
    $conf = new dnsmasq();
    $tbl = explode("\n", $_POST["BulkImport"]);
    writelogs(count($tbl) . " line", __FUNCTION__, __FILE__);
    while (list($num, $ligne) = each($tbl)) {
        if (!preg_match("#(.+?)(,|;)(.+)#", $ligne, $re)) {
            writelogs("{$ligne} no match ", __FUNCTION__, __FILE__);
            continue;
        }
        $server = trim(strtolower($re[1]));
        $adip = trim($re[3]);
        if (!$ip->checkIP($adip)) {
            writelogs("IP {$adip} Failed", __FUNCTION__, __FILE__);
            echo "IP {$adip} Failed";
            continue;
        }
        $conf->array_address[$server] = $adip;
        writelogs("save {$server} {$adip}", __FUNCTION__, __FILE__);
    }
    $conf->SaveConf(true);
}
開發者ID:BillTheBest,項目名稱:1.6.x,代碼行數:23,代碼來源:dnsmasq.hosts.settings.php

示例5: routes_add

function routes_add()
{
    $pattern = "{$_GET["net_1"]}.{$_GET["net_2"]}.{$_GET["net_3"]}.{$_GET["net_4"]}";
    $gw = "{$_GET["gw_1"]}.{$_GET["gw_2"]}.{$_GET["gw_3"]}.{$_GET["gw_4"]}";
    $cdir = "{$_GET["cdir"]}";
    $ip = new networking();
    if (!$ip->checkIP($pattern)) {
        echo "IP {$pattern}\nFailed";
        return;
    }
    if (!$ip->checkIP($gw)) {
        echo "Gateway {$gw}\nFailed";
        return;
    }
    $route_nic = $_GET["route-nic"];
    $type = $_GET["route-type"];
    $md5 = md5("{$route_nic}{$type}{$cdir}{$gw}{$pattern}");
    $sql = "INSERT INTO nic_routes (`type`,`gateway`,`pattern`,`zmd5`,`nic`)\n\tVALUES('{$type}','{$gw}','{$pattern}/{$cdir}','{$md5}','{$route_nic}');";
    $q = new mysql();
    $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        echo $q->mysql_error;
        return;
    }
    $sock = new sockets();
    $sock->getFrameWork("cmd.php?ip-build-routes=yes");
}
開發者ID:BillTheBest,項目名稱:1.6.x,代碼行數:27,代碼來源:system.nic.routes.php


注:本文中的networking::checkIP方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。