本文整理匯總了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();
}
示例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();
}
示例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"]);
}
示例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);
}
示例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");
}