本文整理汇总了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");
}