• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP validate_ip函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中validate_ip函数的典型用法代码示例。如果您正苦于以下问题:PHP validate_ip函数的具体用法?PHP validate_ip怎么用?PHP validate_ip使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了validate_ip函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: validateUrl

/**
 * Returns whether a URL is in a correct format or not
 *
 * @param string URL to be tested
 * @return bool
 * @author Christian Hoffmann
 * @author Froxlor team <[email protected]> (2010-)
 *
 */
function validateUrl($url)
{
    global $idna_convert, $theme;
    if (strtolower(substr($url, 0, 7)) != "http://" && strtolower(substr($url, 0, 8)) != "https://") {
        $url = 'http://' . $url;
    }
    // needs converting
    $url = $idna_convert->encode($url);
    $pattern = "/^https?:\\/\\/[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,4}(\\:[0-9]+)?\\/?(.+)?\$/i";
    if (preg_match($pattern, $url)) {
        return true;
    }
    // not an fqdn
    if (strtolower(substr($url, 0, 7)) == "http://" || strtolower(substr($url, 0, 8)) == "https://") {
        if (strtolower(substr($url, 0, 7)) == "http://") {
            $ip = strtolower(substr($url, 7));
        }
        if (strtolower(substr($url, 0, 8)) == "https://") {
            $ip = strtolower(substr($url, 8));
        }
        $ip = substr($ip, 0, strpos($ip, '/'));
        // possible : in IP (when a port is given), #1173
        // but only if there actually IS ONE
        if (strpos($ip, ':') !== false) {
            $ip = substr($ip, 0, strpos($ip, ':'));
        }
        if (validate_ip($ip, true) !== false) {
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}
开发者ID:cobrafast,项目名称:Froxlor,代码行数:44,代码来源:function.validateUrl.php


示例2: validateUrl

/**
 * Returns whether a URL is in a correct format or not.
 *
 * @param string URL to be tested
 *
 * @return bool
 *
 * @author Christian Hoffmann
 */
function validateUrl($url)
{
    if (strtolower(substr($url, 0, 7)) != 'http://' && strtolower(substr($url, 0, 8)) != 'https://') {
        $url = 'http://' . $url;
    }
    if (filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED) !== false) {
        return true;
    } else {
        if (strtolower(substr($url, 0, 7)) == 'http://' || strtolower(substr($url, 0, 8)) == 'https://') {
            if (strtolower(substr($url, 0, 7)) == 'http://') {
                $ip = strtolower(substr($url, 7));
            }
            if (strtolower(substr($url, 0, 8)) == 'https://') {
                $ip = strtolower(substr($url, 8));
            }
            $ip = substr($ip, 0, strpos($ip, '/'));
            if (validate_ip($ip, true) !== false) {
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }
}
开发者ID:markc,项目名称:syscp,代码行数:35,代码来源:function.validateUrl.php


示例3: validateUrl

/**
 * Returns whether a URL is in a correct format or not
 *
 * @param string URL to be tested
 * @return bool
 * @author Christian Hoffmann
 *
 */
function validateUrl($url)
{
    global $idna_convert;
    if (strtolower(substr($url, 0, 7)) != "http://" && strtolower(substr($url, 0, 8)) != "https://") {
        $url = 'http://' . $url;
    }
    // needs converting
    $url = $idna_convert->encode($url);
    $pattern = "/^https?:\\/\\/[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,4}(\\:[0-9]+)?\\/?(.+)?\$/i";
    if (preg_match($pattern, $url)) {
        return true;
    }
    // not an fqdn
    if (strtolower(substr($url, 0, 7)) == "http://" || strtolower(substr($url, 0, 8)) == "https://") {
        if (strtolower(substr($url, 0, 7)) == "http://") {
            $ip = strtolower(substr($url, 7));
        }
        if (strtolower(substr($url, 0, 8)) == "https://") {
            $ip = strtolower(substr($url, 8));
        }
        $ip = substr($ip, 0, strpos($ip, '/'));
        if (validate_ip($ip, true) !== false) {
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}
开发者ID:Alkyoneus,项目名称:Froxlor,代码行数:38,代码来源:function.validateUrl.php


示例4: checkMysqlAccessHost

/**
 * This file is part of the SysCP project.
 * Copyright (c) 2003-2009 the SysCP Team (see authors).
 *
 * For the full copyright and license information, please view the COPYING
 * file that was distributed with this source code. You can also view the
 * COPYING file online at http://files.syscp.org/misc/COPYING.txt
 *
 * @copyright  (c) the authors
 * @author     Florian Lippert <[email protected]>
 * @license    GPLv2 http://files.syscp.org/misc/COPYING.txt
 *
 * @version    $Id$
 */
function checkMysqlAccessHost($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues)
{
    $mysql_access_host_array = array_map('trim', explode(',', $newfieldvalue));
    foreach ($mysql_access_host_array as $host_entry) {
        if (validate_ip($host_entry, true) == false && validateDomain($host_entry) == false && $host_entry != '%') {
            return array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'invalidmysqlhost', $host_entry);
        }
    }
    return array(FORMFIELDS_PLAUSIBILITY_CHECK_OK);
}
开发者ID:markc,项目名称:syscp,代码行数:24,代码来源:function.checkMysqlAccessHost.php


示例5: forwarded_ip

function forwarded_ip()
{
    $keys = array("HTTP_X_FORWARDED_FOR", "HTTP_X_FORWARDED", "HTTP_FORWARDED_FOR", "HTTP_FORWARDED", "HTTP_CLIENT_IP", "HTTP_X_CLUSTER_CLIENT_IP");
    foreach ($keys as $key) {
        if (isset($_SERVER[$key])) {
            $ip_array = explode(",", $_SERVER[$key]);
            foreach ($ip_array as $ip) {
                $ip = trim($ip);
                if (validate_ip($ip)) {
                    return $ip;
                }
            }
        }
    }
    return "";
}
开发者ID:karoliskliaudaitis,项目名称:single-serving-sites,代码行数:16,代码来源:index.php


示例6: forwarded_ip

function forwarded_ip()
{
    $keys = array('HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'HTTP_CLIENT_IP', 'HTTP_X_CLUSTER_CLIENT-IP');
    foreach ($keys as $key) {
        if (isset($_SERVER[$key])) {
            $ip_array = explode(',', $_SERVER[$key]);
            foreach ($ip_array as $ip) {
                $ip = trim($ip);
                if (validate_ip($ip)) {
                    return $ip;
                }
            }
        }
    }
    return '';
}
开发者ID:JazzinTamra,项目名称:php-projects,代码行数:16,代码来源:what-is-my-ip.php


示例7: getIpAddress1

 public function getIpAddress1()
 {
     $ip_keys = array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR');
     foreach ($ip_keys as $key) {
         if (array_key_exists($key, $_SERVER) === true) {
             foreach (explode(',', $_SERVER[$key]) as $ip) {
                 // trim for safety measures
                 $ip = trim($ip);
                 // attempt to validate IP
                 if (validate_ip($ip)) {
                     return $ip;
                 }
             }
         }
     }
     return isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : false;
 }
开发者ID:cityware,项目名称:city-utility,代码行数:17,代码来源:IpAddress.php


示例8: get_ip_address

function get_ip_address()
{
    $IP_Keys = array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR');
    foreach ($IP_Keys as $Key) {
        if (array_key_exists($Key, $_SERVER) === true) {
            foreach (explode(',', $_SERVER[$Key]) as $IP) {
                // trim for safety measures.
                $IP = trim($IP);
                // attempt to validate IP.
                if (validate_ip($IP)) {
                    return $IP;
                }
            }
        }
    }
    return isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : false;
}
开发者ID:Apfelnerd,项目名称:iNuven,代码行数:17,代码来源:IP.php


示例9: get_ip_address

function get_ip_address()
{
    // check for shared internet/ISP IP
    if (!empty($_SERVER['HTTP_CLIENT_IP']) && validate_ip($_SERVER['HTTP_CLIENT_IP'])) {
        return $_SERVER['HTTP_CLIENT_IP'];
    }
    // check for IPs passing through proxies
    if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        // check if multiple ips exist in var
        if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',') !== false) {
            $iplist = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
            foreach ($iplist as $ip) {
                if (validate_ip($ip)) {
                    return $ip;
                }
            }
        } else {
            if (validate_ip($_SERVER['HTTP_X_FORWARDED_FOR'])) {
                return $_SERVER['HTTP_X_FORWARDED_FOR'];
            }
        }
    }
    if (!empty($_SERVER['HTTP_X_FORWARDED']) && validate_ip($_SERVER['HTTP_X_FORWARDED'])) {
        return $_SERVER['HTTP_X_FORWARDED'];
    }
    if (!empty($_SERVER['HTTP_X_CLUSTER_CLIENT_IP']) && validate_ip($_SERVER['HTTP_X_CLUSTER_CLIENT_IP'])) {
        return $_SERVER['HTTP_X_CLUSTER_CLIENT_IP'];
    }
    if (!empty($_SERVER['HTTP_FORWARDED_FOR']) && validate_ip($_SERVER['HTTP_FORWARDED_FOR'])) {
        return $_SERVER['HTTP_FORWARDED_FOR'];
    }
    if (!empty($_SERVER['HTTP_FORWARDED']) && validate_ip($_SERVER['HTTP_FORWARDED'])) {
        return $_SERVER['HTTP_FORWARDED'];
    }
    // return unreliable ip since all else failed
    echo $_SERVER['REMOTE_ADDR'];
    return $_SERVER['REMOTE_ADDR'];
}
开发者ID:jorgemauricio,项目名称:lnmysr,代码行数:38,代码来源:php_soapclient.php


示例10: AddBan

function AddBan($nickname, $type, $steam, $ip, $length, $dfile, $dname, $reason, $fromsub)
{
    $objResponse = new xajaxResponse();
    global $userbank, $username;
    if (!$userbank->HasAccess(ADMIN_OWNER | ADMIN_ADD_BAN)) {
        $objResponse->redirect("index.php?p=login&m=no_access", 0);
        $log = new CSystemLog("w", "Ошибка доступа", $username . " пытался добавить бан, не имея на то прав.");
        return $objResponse;
    }
    $steam = trim($steam);
    $error = 0;
    // If they didnt type a steamid
    if (empty($steam) && $type == 0) {
        $error++;
        $objResponse->addAssign("steam.msg", "innerHTML", "Введите Steam ID или Community ID");
        $objResponse->addScript("\$('steam.msg').setStyle('display', 'block');");
    } else {
        if ($type == 0 && !is_numeric($steam) && !validate_steam($steam) || is_numeric($steam) && (strlen($steam) < 15 || !validate_steam($steam = FriendIDToSteamID($steam)))) {
            $error++;
            $objResponse->addAssign("steam.msg", "innerHTML", "Введите действительный Steam ID или Community ID");
            $objResponse->addScript("\$('steam.msg').setStyle('display', 'block');");
        } else {
            if (empty($ip) && $type == 1) {
                $error++;
                $objResponse->addAssign("ip.msg", "innerHTML", "Введите IP");
                $objResponse->addScript("\$('ip.msg').setStyle('display', 'block');");
            } else {
                if ($type == 1 && !validate_ip($ip)) {
                    $error++;
                    $objResponse->addAssign("ip.msg", "innerHTML", "Введите действительный IP");
                    $objResponse->addScript("\$('ip.msg').setStyle('display', 'block');");
                } else {
                    $objResponse->addAssign("steam.msg", "innerHTML", "");
                    $objResponse->addScript("\$('steam.msg').setStyle('display', 'none');");
                    $objResponse->addAssign("ip.msg", "innerHTML", "");
                    $objResponse->addScript("\$('ip.msg').setStyle('display', 'none');");
                }
            }
        }
    }
    if ($error > 0) {
        return $objResponse;
    }
    $nickname = RemoveCode($nickname);
    $ip = preg_replace('#[^\\d\\.]#', '', $ip);
    //strip ip of all but numbers and dots
    $dname = RemoveCode($dname);
    $reason = RemoveCode($reason);
    if (!$length) {
        $len = 0;
    } else {
        $len = $length * 60;
    }
    // prune any old bans
    PruneBans();
    if ((int) $type == 0) {
        // Check if the new steamid is already banned
        $chk = $GLOBALS['db']->GetRow("SELECT count(bid) AS count FROM " . DB_PREFIX . "_bans WHERE authid = ? AND (length = 0 OR ends > UNIX_TIMESTAMP()) AND RemovedBy IS NULL AND type = '0'", array($steam));
        if (intval($chk[0]) > 0) {
            $objResponse->addScript("ShowBox('Ошибка', 'SteamID: {$steam} уже забанен.', 'red', '');");
            return $objResponse;
        }
        // Check if player is immune
        $admchk = $userbank->GetAllAdmins();
        foreach ($admchk as $admin) {
            if ($admin['authid'] == $steam && $userbank->GetProperty('srv_immunity') < $admin['srv_immunity']) {
                $objResponse->addScript("ShowBox('Ошибка', 'SteamID админа " . $admin['user'] . " ({$steam}) под иммунитетом.', 'red', '');");
                return $objResponse;
            }
        }
    }
    if ((int) $type == 1) {
        $chk = $GLOBALS['db']->GetRow("SELECT count(bid) AS count FROM " . DB_PREFIX . "_bans WHERE ip = ? AND (length = 0 OR ends > UNIX_TIMESTAMP()) AND RemovedBy IS NULL AND type = '1'", array($ip));
        if (intval($chk[0]) > 0) {
            $objResponse->addScript("ShowBox('Ошибка', 'Этот IP ({$ip}) уже забанен.', 'red', '');");
            return $objResponse;
        }
    }
    $pre = $GLOBALS['db']->Prepare("INSERT INTO " . DB_PREFIX . "_bans(created,type,ip,authid,name,ends,length,reason,aid,adminIp ) VALUES\r\n\t\t\t\t\t\t\t\t\t(UNIX_TIMESTAMP(),?,?,?,?,(UNIX_TIMESTAMP() + ?),?,?,?,?)");
    $GLOBALS['db']->Execute($pre, array($type, $ip, $steam, $nickname, $length * 60, $len, $reason, $userbank->GetAid(), $_SERVER['REMOTE_ADDR']));
    $subid = $GLOBALS['db']->Insert_ID();
    if ($dname && $dfile) {
        $GLOBALS['db']->Execute("INSERT INTO " . DB_PREFIX . "_demos(demid,demtype,filename,origname)\r\n\t\t\t\t\t\t     VALUES(?,'B', ?, ?)", array((int) $subid, $dfile, $dname));
    }
    if ($fromsub) {
        $submail = $GLOBALS['db']->Execute("SELECT name, email FROM " . DB_PREFIX . "_submissions WHERE subid = '" . (int) $fromsub . "'");
        // Send an email when ban is accepted
        $requri = substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], ".php") + 4);
        $headers = 'From: submission@' . $_SERVER['HTTP_HOST'] . "\n" . 'X-Mailer: PHP/' . phpversion();
        $message = "Привет,\n";
        $message .= "Ваша заявка на бан подтверждена админом.\nПерейдите по ссылке, чтобы посмотреть банлист.\n\nhttp://" . $_SERVER['HTTP_HOST'] . $requri . "?p=banlist";
        mail($submail->fields['email'], "[SourceBans] Бан добавлен", $message, $headers);
        $GLOBALS['db']->Execute("UPDATE `" . DB_PREFIX . "_submissions` SET archiv = '2', archivedby = '" . $userbank->GetAid() . "' WHERE subid = '" . (int) $fromsub . "'");
    }
    $GLOBALS['db']->Execute("UPDATE `" . DB_PREFIX . "_submissions` SET archiv = '3', archivedby = '" . $userbank->GetAid() . "' WHERE SteamId = ?;", array($steam));
    $kickit = isset($GLOBALS['config']['config.enablekickit']) && $GLOBALS['config']['config.enablekickit'] == "1";
    if ($kickit) {
        $objResponse->addScript("ShowKickBox('" . ((int) $type == 0 ? $steam : $ip) . "', '" . (int) $type . "');");
    } else {
        $objResponse->addScript("ShowBox('Бан добавлен', 'Бан успешно добавлен', 'green', 'index.php?p=admin&c=bans');");
//.........这里部分代码省略.........
开发者ID:BGCX261,项目名称:zion-downloads-css-svn-to-git,代码行数:101,代码来源:sb-callback.php


示例11: trim

    $SID = -1;
} else {
    $SteamID = trim(htmlspecialchars($_POST['SteamID']));
    $BanIP = trim(htmlspecialchars($_POST['BanIP']));
    $PlayerName = htmlspecialchars($_POST['PlayerName']);
    $BanReason = htmlspecialchars($_POST['BanReason']);
    $SubmitterName = htmlspecialchars($_POST['SubmitName']);
    $Email = trim(htmlspecialchars($_POST['EmailAddr']));
    $SID = (int) $_POST['server'];
    $validsubmit = true;
    $errors = "";
    if (strlen($SteamID) != 0 && $SteamID != "STEAM_0:" && !validate_steam($SteamID)) {
        $errors .= '* Please type a valid STEAM ID.<br>';
        $validsubmit = false;
    }
    if (strlen($BanIP) != 0 && !validate_ip($BanIP)) {
        $errors .= '* Please type a valid IP-address.<br>';
        $validsubmit = false;
    }
    if (strlen($PlayerName) == 0) {
        $errors .= '* You must include a player name<br>';
        $validsubmit = false;
    }
    if (strlen($BanReason) == 0) {
        $errors .= '* You must include comments<br>';
        $validsubmit = false;
    }
    if (!check_email($Email)) {
        $errors .= '* You must include a valid email address<br>';
        $validsubmit = false;
    }
开发者ID:CodingDK,项目名称:SourceBans-Fork,代码行数:31,代码来源:page.submit.php


示例12: status_message

 status_message('begin', $lng['install']['testing_new_db']);
 $db = new db($mysql_host, $mysql_unpriv_user, $mysql_unpriv_pass, $mysql_database);
 status_message('green', 'OK');
 status_message('begin', $lng['install']['importing_data']);
 $db_schema = './syscp.sql';
 $sql_query = @file_get_contents($db_schema, 'r');
 $sql_query = remove_remarks($sql_query);
 $sql_query = split_sql_file($sql_query, ';');
 for ($i = 0; $i < sizeof($sql_query); ++$i) {
     if (trim($sql_query[$i]) != '') {
         $result = $db->query($sql_query[$i]);
     }
 }
 status_message('green', 'OK');
 status_message('begin', 'System Servername...');
 if (validate_ip($_SERVER['SERVER_NAME'], true) !== false) {
     status_message('red', $lng['install']['servername_should_be_fqdn']);
 } else {
     status_message('green', 'OK');
 }
 //now let's change the settings in our settings-table
 status_message('begin', $lng['install']['changing_data']);
 $db->query('UPDATE `' . TABLE_PANEL_SETTINGS . "` SET `value` = 'admin@" . $db->escape($servername) . "' WHERE `settinggroup` = 'panel' AND `varname` = 'adminmail'");
 $db->query('UPDATE `' . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($serverip) . "' WHERE `settinggroup` = 'system' AND `varname` = 'ipaddress'");
 $db->query('UPDATE `' . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($servername) . "' WHERE `settinggroup` = 'system' AND `varname` = 'hostname'");
 $db->query('UPDATE `' . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($dbversion) . "' WHERE `settinggroup` = 'system' AND `varname` = 'dbversion'");
 $db->query('UPDATE `' . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($languages[$language]) . "' WHERE `settinggroup` = 'panel' AND `varname` = 'standardlanguage'");
 $db->query('UPDATE `' . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($mysql_access_host) . "' WHERE `settinggroup` = 'system' AND `varname` = 'mysql_access_host'");
 $db->query('UPDATE `' . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($webserver) . "' WHERE `settinggroup` = 'system' AND `varname` = 'webserver'");
 $db->query('UPDATE `' . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($webserver) . "' WHERE `settinggroup` = 'system' AND `varname` = 'webserver'");
 //FIXME
开发者ID:markc,项目名称:syscp,代码行数:31,代码来源:install.php


示例13: _insertAllowedTransfers

 private function _insertAllowedTransfers($domainid)
 {
     $ins_stmt = $this->pdns_db->prepare("\n\t\t\tINSERT INTO domainmetadata set `domain_id` = :did, `kind` = 'ALLOW-AXFR-FROM', `content` = :value\n\t\t");
     $ins_data = array('did' => $domainid);
     if (count($this->_ns) > 0 || count($this->_axfr) > 0) {
         // put nameservers in allow-transfer
         if (count($this->_ns) > 0) {
             foreach ($this->_ns as $ns) {
                 foreach ($ns["ips"] as $ip) {
                     $ins_data['value'] = $ip;
                     $ins_stmt->execute($ins_data);
                 }
             }
         }
         // AXFR server #100
         if (count($this->_axfr) > 0) {
             foreach ($this->_axfr as $axfrserver) {
                 if (validate_ip($axfrserver, true) !== false) {
                     $ins_data['value'] = $axfrserver;
                     $ins_stmt->execute($ins_data);
                 }
             }
         }
     }
 }
开发者ID:hypernics,项目名称:Froxlor,代码行数:25,代码来源:cron_tasks.inc.dns.20.pdns.php


示例14:

        if (strlen($_POST['password']) > 100) {
            $errors[] = 'Your password must be less than 100 characters.';
        }
        if ($_POST['password'] !== $_POST['password_again']) {
            $errors[] = 'Your passwords do not match.';
        }
        if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) === false) {
            $errors[] = 'A valid email address is required.';
        }
        if (user_email_exist($_POST['email']) === true) {
            $errors[] = 'That email address is already in use.';
        }
        if ($_POST['selected'] != 1) {
            $errors[] = 'You are only allowed to have an account if you accept the rules.';
        }
        if (validate_ip(getIP()) === false && $config['validate_IP'] === true) {
            $errors[] = 'Failed to recognize your IP address. (Not a valid IPv4 address).';
        }
    }
}
?>
<h1>Register Account</h1>
<?php 
if (isset($_GET['success']) && empty($_GET['success'])) {
    if ($config['mailserver']['register']) {
        ?>
		<h1>Email authentication required</h1>
		<p>We have sent you an email with an activation link to your submitted email address.</p>
		<p>If you can't find the email within 5 minutes, check your junk/trash inbox as it may be mislocated there.</p>
		<?php 
    } else {
开发者ID:niemoralny,项目名称:ZnoteAAC,代码行数:31,代码来源:register.php


示例15: _generateDomainConfig

 private function _generateDomainConfig($domain = array())
 {
     if (isset($domain['froxlorhost']) && $domain['froxlorhost'] === '1') {
         $froxlorhost = true;
     } else {
         $froxlorhost = false;
     }
     $bindconf_file = '# Domain ID: ' . $domain['id'] . ' - CustomerID: ' . $domain['customerid'] . ' - CustomerLogin: ' . $domain['loginname'] . "\n";
     $bindconf_file .= 'zone "' . $domain['domain'] . '" in {' . "\n";
     $bindconf_file .= '	type master;' . "\n";
     $bindconf_file .= '	file "' . makeCorrectFile(Settings::Get('system.bindconf_directory') . '/' . $domain['zonefile']) . '";' . "\n";
     $bindconf_file .= '	allow-query { any; };' . "\n";
     if (count($this->nameservers) > 0 || count($this->axfrservers) > 0) {
         // open allow-transfer
         $bindconf_file .= '	allow-transfer {' . "\n";
         // put nameservers in allow-transfer
         if (count($this->nameservers) > 0) {
             foreach ($this->nameservers as $ns) {
                 $bindconf_file .= '		' . $ns['ip'] . ';' . "\n";
             }
         }
         // AXFR server #100
         if (count($this->axfrservers) > 0) {
             foreach ($this->axfrservers as $axfrserver) {
                 if (validate_ip($axfrserver, true) !== false) {
                     $bindconf_file .= '		' . $axfrserver . ';' . "\n";
                 }
             }
         }
         // close allow-transfer
         $bindconf_file .= '	};' . "\n";
     }
     $bindconf_file .= '};' . "\n";
     $bindconf_file .= "\n";
     return $bindconf_file;
 }
开发者ID:nabeel-khan,项目名称:Froxlor,代码行数:36,代码来源:cron_tasks.inc.dns.10.bind.php


示例16: inserttask

             // Using nameserver, insert a task which rebuilds the server config
             inserttask('4');
             redirectTo($filename, array('page' => $page, 's' => $s));
         }
     } else {
         $ipsandports_add_data = (include_once dirname(__FILE__) . '/lib/formfields/admin/formfield.ipsandports.php');
         $ipsandports_add_form = HTMLform2::genHTMLForm($ipsandports_add_data);
         $title = $lng['admin']['ipsandports']['add'];
         eval("echo \"" . getTemplate("ipsandports/ipsandports_add") . "\";");
     }
 } elseif ($action == 'edit' && $id != 0) {
     $result_stmt = Database::prepare("\n\t\t\tSELECT * FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id` = :id");
     $result = Database::pexecute_first($result_stmt, array('id' => $id));
     if ($result['ip'] != '') {
         if (isset($_POST['send']) && $_POST['send'] == 'send') {
             $ip = validate_ip($_POST['ip']);
             $port = validate($_POST['port'], 'port', '/^(([1-9])|([1-9][0-9])|([1-9][0-9][0-9])|([1-9][0-9][0-9][0-9])|([1-5][0-9][0-9][0-9][0-9])|(6[0-4][0-9][0-9][0-9])|(65[0-4][0-9][0-9])|(655[0-2][0-9])|(6553[0-5]))$/Di', array('stringisempty', 'myport'));
             $listen_statement = isset($_POST['listen_statement']) ? 1 : 0;
             $namevirtualhost_statement = isset($_POST['namevirtualhost_statement']) ? 1 : 0;
             $vhostcontainer = isset($_POST['vhostcontainer']) ? 1 : 0;
             $specialsettings = validate(str_replace("\r\n", "\n", $_POST['specialsettings']), 'specialsettings', '/^[^\\0]*$/');
             $vhostcontainer_servername_statement = isset($_POST['vhostcontainer_servername_statement']) ? 1 : 0;
             $default_vhostconf_domain = validate(str_replace("\r\n", "\n", $_POST['default_vhostconf_domain']), 'default_vhostconf_domain', '/^[^\\0]*$/');
             $docroot = validate($_POST['docroot'], 'docroot');
             $result_checkfordouble_stmt = Database::prepare("\n\t\t\t\t\tSELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "`\n\t\t\t\t\tWHERE `ip` = :ip AND `port` = :port");
             $result_checkfordouble = Database::pexecute_first($result_checkfordouble_stmt, array('ip' => $ip, 'port' => $port));
             $result_sameipotherport_stmt = Database::prepare("\n\t\t\t\t\tSELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "`\n\t\t\t\t\tWHERE `ip` = :ip AND `id` <> :id");
             $result_sameipotherport = Database::pexecute_first($result_sameipotherport_stmt, array('ip' => $ip, 'id' => $id));
             if ((int) Settings::Get('system.use_ssl') == 1 && isset($_POST['ssl']) && $_POST['ssl'] != 0) {
                 $ssl = 1;
                 $ssl_cert_file = validate($_POST['ssl_cert_file'], 'ssl_cert_file');
开发者ID:mowamed,项目名称:Froxlor,代码行数:31,代码来源:admin_ipsandports.php


示例17: check_type

function check_type(&$field, $flags, &$var, $type, $caption = null)
{
    if (is_null($caption)) {
        $caption = $field;
    }
    if (is_array($var) && $type != T_ZBX_IP) {
        $err = ZBX_VALID_OK;
        foreach ($var as $el) {
            $err |= check_type($field, $flags, $el, $type);
        }
        return $err;
    }
    if ($type == T_ZBX_IP) {
        if (!validate_ip($var, $arr)) {
            if ($flags & P_SYS) {
                info(_s('Critical error. Field "%1$s" is not IP.', $field));
                return ZBX_VALID_ERROR;
            } else {
                info(_s('Warning. Field "%1$s" is not IP.', $field));
                return ZBX_VALID_WARNING;
            }
        }
        return ZBX_VALID_OK;
    }
    if ($type == T_ZBX_IP_RANGE) {
        if (!validate_ip_range($var)) {
            if ($flags & P_SYS) {
                info(_s('Critical error. Field "%1$s" is not IP range.', $field));
                return ZBX_VALID_ERROR;
            } else {
                info(_s('Warning. Field "%1$s" is not IP range.', $field));
                return ZBX_VALID_WARNING;
            }
        }
        return ZBX_VALID_OK;
    }
    if ($type == T_ZBX_INT_RANGE) {
        if (!is_int_range($var)) {
            if ($flags & P_SYS) {
                info(_s('Critical error. Field "%1$s" is not integer list or range.', $field));
                return ZBX_VALID_ERROR;
            } else {
                info(_s('Warning. Field "%1$s" is not integer list or range.', $field));
                return ZBX_VALID_WARNING;
            }
        }
        return ZBX_VALID_OK;
    }
    if ($type == T_ZBX_INT && !zbx_is_int($var)) {
        if ($flags & P_SYS) {
            info(_s('Critical error. Field "%1$s" is not integer.', $field));
            return ZBX_VALID_ERROR;
        } else {
            info(_s('Warning. Field "%1$s" is not integer.', $field));
            return ZBX_VALID_WARNING;
        }
    }
    if ($type == T_ZBX_DBL && !is_numeric($var)) {
        if ($flags & P_SYS) {
            info(_s('Critical error. Field "%1$s" is not decimal number.', $field));
            return ZBX_VALID_ERROR;
        } else {
            info(_s('Warning. Field "%1$s" is not decimal number.', $field));
            return ZBX_VALID_WARNING;
        }
    }
    if ($type == T_ZBX_STR && !is_string($var)) {
        if ($flags & P_SYS) {
            info(_s('Critical error. Field "%1$s" is not string.', $field));
            return ZBX_VALID_ERROR;
        } else {
            info(_s('Warning. Field "%1$s" is not string.', $field));
            return ZBX_VALID_WARNING;
        }
    }
    if ($type == T_ZBX_STR && !defined('ZBX_ALLOW_UNICODE') && zbx_strlen($var) != zbx_strlen($var)) {
        if ($flags & P_SYS) {
            info(_s('Critical error. Field "%1$s" contains Multibyte chars.', $field));
            return ZBX_VALID_ERROR;
        } else {
            info(_s('Warning. Field "%1$s" multibyte chars are restricted.', $field));
            return ZBX_VALID_ERROR;
        }
    }
    if ($type == T_ZBX_CLR && !is_hex_color($var)) {
        $var = 'FFFFFF';
        if ($flags & P_SYS) {
            info(_s('Critical error. Field "%1$s" is not a colour.', $field));
            return ZBX_VALID_ERROR;
        } else {
            info(_s('Warning. Field "%1$s" is not a colour.', $caption));
            return ZBX_VALID_WARNING;
        }
    }
    return ZBX_VALID_OK;
}
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:96,代码来源:validate.inc.php


示例18: popup_error

             popup_error(sprintf(_("Unknown server '%s'"), $_REQUEST['server']));
             redirect();
         }
         $_SESSION['service']->server_set_fqdn($_REQUEST['server'], $_REQUEST['fqdn']);
         popup_info(sprintf(_("Server '%s' successfully modified"), $server->fqdn));
         redirect('servers.php?action=manage&id=' . $server->id);
     }
 }
 if ($_REQUEST['action'] == 'external_name') {
     if (!isset($_REQUEST['server'])) {
         redirect();
     }
     if (!isset($_REQUEST['external_name']) || strlen($_REQUEST['external_name']) == 0) {
         $external_name = null;
     } else {
         if (!validate_ip($_REQUEST['external_name']) && !validate_fqdn($_REQUEST['external_name'])) {
             popup_error(sprintf(_("Redirection name \"%s\" is invalid"), $_REQUEST['external_name']));
             redirect();
         }
         $external_name = $_REQUEST['external_name'];
     }
     $server = $_SESSION['service']->server_info($_REQUEST['server']);
     if (!is_object($server)) {
         popup_error(sprintf(_("Unknown server '%s'"), $_REQUEST['server']));
         redirect();
     }
     if ($external_name !== null) {
         $_SESSION['service']->server_set_external_name($_REQUEST['server'], $external_name);
     } else {
         $_SESSION['service']->server_unset_external_name($_REQUEST['server']);
     }
开发者ID:bloveing,项目名称:openulteo,代码行数:31,代码来源:actions.php


示例19: check_type

function check_type(&$field, $flags, &$var, $type, $caption = null)
{
    if ($caption === null) {
        $caption = $field;
    }
    if (is_array($var) && $type != T_ZBX_IP) {
        $err = ZBX_VALID_OK;
        foreach ($var as $v) {
            $err |= check_type($field, $flags, $v, $type);
        }
        return $err;
    }
    $error = false;
    $message = '';
    if ($type == T_ZBX_IP) {
        if (!validate_ip($var, $arr)) {
            $error = true;
            $message = _s('Field "%1$s" is not IP.', $caption);
        }
    } elseif ($type == T_ZBX_IP_RANGE) {
        if (!validate_ip_range($var)) {
            $error = true;
            $message = _s('Field "%1$s" is not IP range.', $caption);
        }
    } elseif ($type == T_ZBX_INT_RANGE) {
        if (!is_int_range($var)) {
            $error = true;
            $message = _s('Field "%1$s" is not integer list or range.', $caption);
        }
    } elseif ($type == T_ZBX_INT) {
        if (!zbx_is_int($var)) {
            $error = true;
            $message = _s('Field "%1$s" is not integer.', $caption);
        }
    } elseif ($type == T_ZBX_DBL) {
        $decimalValidator = new CDecimalValidator(array('maxPrecision' => 16, 'maxScale' => 4, 'messageInvalid' => _('Value "%2$s" of "%1$s" has incorrect decimal format.'), 'messagePrecision' => _('Value "%2$s" of "%1$s" is too long: it cannot have more than %3$s digits before the decimal point ' . 'and more than %4$s digits after the decimal point.'), 'messageNatural' => _('Value "%2$s" of "%1$s" has too many digits before the decimal point: ' . 'it cannot have more than %3$s digits.'), 'messageScale' => _('Value "%2$s" of "%1$s" has too many digits after the decimal point: ' . 'it cannot have more than %3$s digits.')));
        $decimalValidator->setObjectName($caption);
        if (!$decimalValidator->validate($var)) {
            $error = true;
            $message = $decimalValidator->getError();
        }
    } elseif ($type == T_ZBX_DBL_BIG) {
        $decimalValidator = new CDecimalValidator(array('maxScale' => 4, 'messageInvalid' => _('Value "%2$s" of "%1$s" has incorrect decimal format.'), 'messageScale' => _('Value "%2$s" of "%1$s" has too many digits after the decimal point: ' . 'it cannot have more than %3$s digits.')));
        $decimalValidator->setObjectName($caption);
        if (!$decimalValidator->validate($var)) {
            $error = true;
            $message = $decimalValidator->getError();
        }
    } elseif ($type == T_ZBX_DBL_STR) {
        $decimalStringValidator = new CDecimalStringValidator(array('messageInvalid' => _('Value "%2$s" of "%1$s" has incorrect decimal format.')));
        $decimalStringValidator->setObjectName($caption);
        if (!$decimalStringValidator->validate($var)) {
            $error = true;
            $message = $decimalStringValidator->getError();
        }
    } elseif ($type == T_ZBX_STR) {
        if (!is_string($var)) {
            $error = true;
            $message = _s('Field "%1$s" is not string.', $caption);
        }
    } elseif ($type == T_ZBX_CLR) {
        $colorValidator = new CColorValidator();
        if (!$colorValidator->validate($var)) {
            $var = 'FFFFFF';
            $error = true;
            $message = _s('Colour "%1$s" is not correct: expecting hexadecimal colour code (6 symbols).', $caption);
        }
    }
    if ($error) {
        if ($flags & P_SYS) {
            error($message);
            return ZBX_VALID_ERROR;
        } else {
            info($message);
            return ZBX_VALID_WARNING;
        }
    }
    return ZBX_VALID_OK;
}
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:79,代码来源:validate.inc.php


示例20: check_type

function check_type(&$field, $flags, &$var, $type)
{
    if (is_array($var) && $type != T_ZBX_IP) {
        $err = ZBX_VALID_OK;
        foreach ($var as $el) {
            $err |= check_type($field, $flags, $el, $type);
        }
        return $err;
    }
    if ($type == T_ZBX_IP) {
        if (!validate_ip($var, $arr)) {
            if ($flags & P_SYS) {
                info("Critical error. Field [" . $field . "] is not IP");
                return ZBX_VALID_ERROR;
            } else {
                info("Warning. Field [" . $field . "] is not IP");
                return ZBX_VALID_WARNING;
            }
        }
        return ZBX_VALID_OK;
    }
    if ($type == T_ZBX_IP_RANGE) {
        if (!validate_ip_range($var)) {
            if ($flags & P_SYS) {
                info("Critical error. Field [" . $field . "] is not IP range");
                return ZBX_VALID_ERROR;
            } else {
                info("Warning. Field [" . $field . "] is not IP  

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP validate_length函数代码示例发布时间:2022-05-23
下一篇:
PHP validate_internal_user_password函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap