本文整理汇总了PHP中Net_IPv4::validateip方法的典型用法代码示例。如果您正苦于以下问题:PHP Net_IPv4::validateip方法的具体用法?PHP Net_IPv4::validateip怎么用?PHP Net_IPv4::validateip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Net_IPv4
的用法示例。
在下文中一共展示了Net_IPv4::validateip方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ini_set
ini_set('error_reporting', E_ALL);
}
require '../includes/defaults.inc.php';
require '../config.php';
require_once '../includes/definitions.inc.php';
require 'includes/functions.inc.php';
require '../includes/functions.php';
require 'includes/authenticate.inc.php';
if (!$_SESSION['authenticated']) {
echo 'unauthenticated';
exit;
}
$output = '';
if ($_GET['query'] && $_GET['cmd']) {
$host = $_GET['query'];
if (Net_IPv6::checkIPv6($host) || Net_IPv4::validateip($host) || filter_var('http://' . $host, FILTER_VALIDATE_URL)) {
switch ($_GET['cmd']) {
case 'whois':
$cmd = $config['whois'] . " {$host} | grep -v \\%";
break;
case 'ping':
$cmd = $config['ping'] . " -c 5 {$host}";
break;
case 'tracert':
$cmd = $config['mtr'] . " -r -c 5 {$host}";
break;
case 'nmap':
if ($_SESSION['userlevel'] != '10') {
echo 'insufficient privileges';
} else {
$cmd = $config['nmap'] . " {$host}";
示例2: ini_set
ini_set('error_reporting', E_ALL);
}
require '../includes/defaults.inc.php';
require '../config.php';
require_once '../includes/definitions.inc.php';
require 'includes/functions.inc.php';
require '../includes/functions.php';
require 'includes/authenticate.inc.php';
if (!$_SESSION['authenticated']) {
echo 'unauthenticated';
exit;
}
$output = '';
if ($_GET['query'] && $_GET['cmd']) {
$host = $_GET['query'];
if (Net_IPv6::checkIPv6($host) || Net_IPv4::validateip($host) || preg_match('/^[a-zA-Z0-9.-]*$/', $host)) {
switch ($_GET['cmd']) {
case 'whois':
$cmd = $config['whois'] . " {$host} | grep -v \\%";
break;
case 'ping':
$cmd = $config['ping'] . " -c 5 {$host}";
break;
case 'tracert':
$cmd = $config['mtr'] . " -r -c 5 {$host}";
break;
case 'nmap':
if ($_SESSION['userlevel'] != '10') {
echo 'insufficient privileges';
} else {
$cmd = $config['nmap'] . " {$host}";