当前位置: 首页>>代码示例>>PHP>>正文


PHP validate::username方法代码示例

本文整理汇总了PHP中validate::username方法的典型用法代码示例。如果您正苦于以下问题:PHP validate::username方法的具体用法?PHP validate::username怎么用?PHP validate::username使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在validate的用法示例。


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

示例1: validate

 static function validate()
 {
     if (!sys_validate_token()) {
         return "{t}Invalid security token{/t}";
     }
     if ($_REQUEST["setup_admin_user"] != SETUP_ADMIN_USER and $validate = validate::username($_REQUEST["setup_admin_user"]) and $validate != "") {
         return "{t}Admin Username{/t}: {t}validation failed{/t} " . $validate;
     }
     if ($_REQUEST["setup_admin_user2"] != "" and $_REQUEST["setup_admin_user2"] != SETUP_ADMIN_USER2 and $validate = validate::username($_REQUEST["setup_admin_user2"]) and $validate != "") {
         return "{t}Admin Username{/t} (2): {t}validation failed{/t} " . $validate;
     }
     if (!is_numeric($_REQUEST["login_timeout"]) or $_REQUEST["login_timeout"] <= 60) {
         return "{t}Session timeout{/t}: {t}validation failed{/t}";
     }
     if ($_REQUEST["setup_db_host"] == "") {
         return "{t}missing field{/t}: {t}Database Hostname / IP{/t}";
     }
     if ($_REQUEST["setup_db_user"] == "") {
         return "{t}missing field{/t}: {t}Database User{/t}";
     }
     if ($_REQUEST["setup_db_name"] == "") {
         return "{t}missing field{/t}: {t}Database Name{/t}";
     }
     if (empty($_REQUEST["setup_auth"])) {
         return "{t}missing field{/t}: {t}Authentication Mode{/t}";
     }
     if (!sql_connect($_REQUEST["setup_db_host"], $_REQUEST["setup_db_user"], $_REQUEST["setup_db_pw"], $_REQUEST["setup_db_name"])) {
         return "{t}Connection to database failed.{/t}\n" . sql_error();
     }
     if (empty($_REQUEST["simple_cache"]) or !is_dir($_REQUEST["simple_cache"])) {
         return "SIMPLE_CACHE: {t}validation failed{/t} " . $_REQUEST["simple_cache"];
     }
     if (empty($_REQUEST["simple_store"]) or !is_dir($_REQUEST["simple_store"])) {
         return "SIMPLE_STORE: {t}validation failed{/t} " . $_REQUEST["simple_store"];
     }
     if (empty($_REQUEST["simple_custom"]) or !is_dir($_REQUEST["simple_custom"])) {
         return "SIMPLE_CUSTOM: {t}validation failed{/t} " . $_REQUEST["simple_custom"];
     }
     if (empty($_REQUEST["simple_ext"]) or !is_dir($_REQUEST["simple_ext"])) {
         return "SIMPLE_EXT: {t}validation failed{/t} " . $_REQUEST["simple_ext"];
     }
     if (!empty($_REQUEST["apc_session"]) and !APC) {
         return sprintf("{t}Please install the php-extension with name '%s'.{/t}", "apc");
     }
     if (strlen($_REQUEST["setup_admin_pw"]) < 5) {
         return "{t}Admin Password{/t}: {t}Password must be not null, min 5 characters.{/t}";
     }
     if (strlen($_REQUEST["setup_admin_pw2"]) < 5 and $_REQUEST["setup_admin_user2"] != "") {
         return "{t}Admin Password{/t} (2): {t}Password must be not null, min 5 characters.{/t}";
     }
     if (!empty($_REQUEST["sync4j"])) {
         echo sprintf("{t}Processing %s ...{/t}", "Funambol schema") . "<br>";
         if (SETUP_DB_TYPE == "mysqli") {
             $data = preg_replace("!/\\*.+?\\*/!s", "", file_get_contents("tools/funambolv7_syncML/mysql/funambol.sql"));
             if ($msg = db_query(explode(";", $data))) {
                 return "funambol.sql [mysql]: " . $msg . "<br>";
             }
         } else {
             if (SETUP_DB_TYPE == "pgsql") {
                 $data = file_get_contents("tools/funambolv7_syncML/postgresql/funambol.sql");
                 if ($msg = db_query($data)) {
                     return "funambol.sql [pgsql]: " . $msg . "<br>";
                 }
             } else {
                 return "{t}Funambol only works with MySQL and PostgreSQL.{/t}<br>";
             }
         }
     }
     return "";
 }
开发者ID:drognisep,项目名称:Simple-Groupware,代码行数:70,代码来源:sysconfig.php

示例2: validate_input

 static function validate_input($databases)
 {
     if ($validate = validate::username($_REQUEST["admin_user"]) and $validate != "") {
         setup::error_add("{t}Admin Username{/t} - {t}validation failed{/t} " . $validate, 30);
     }
     if ($_REQUEST["db_host"] == "") {
         setup::error_add(sprintf("{t}missing field{/t}: %s", "{t}Database Hostname / IP{/t}"), 31);
     }
     if ($_REQUEST["db_user"] == "") {
         setup::error_add(sprintf("{t}missing field{/t}: %s", "{t}Database User{/t}"), 32);
     }
     if ($_REQUEST["db_name"] == "") {
         setup::error_add(sprintf("{t}missing field{/t}: %s", "{t}Database Name{/t}"), 33);
     }
     if ($_REQUEST["admin_pw"] == "") {
         setup::error_add(sprintf("{t}missing field{/t}: %s", "{t}Admin Password{/t}"), 34);
     }
     if ($_REQUEST["admin_pw"] != "" and strlen($_REQUEST["admin_pw"]) < 5) {
         setup::error_add("{t}Admin Password{/t}: {t}Password must be not null, min 5 characters.{/t}", "34b");
     }
     if (!@sql_connect($_REQUEST["db_host"], $_REQUEST["db_user"], $_REQUEST["db_pw"], $_REQUEST["db_name"])) {
         if (!sql_connect($_REQUEST["db_host"], $_REQUEST["db_user"], $_REQUEST["db_pw"])) {
             setup::error_add("{t}Connection to database failed.{/t}\n" . sql_error(), 35);
         }
         setup::errors_show();
         if (!sgsml_parser::create_database($_REQUEST["db_name"])) {
             setup::error_add("{t}Creating database failed.{/t}\n" . sql_error(), 36);
         }
     }
     if (!sql_connect($_REQUEST["db_host"], $_REQUEST["db_user"], $_REQUEST["db_pw"], $_REQUEST["db_name"]) or empty(sys::$db)) {
         setup::error_add("{t}Connection to database failed.{/t}\n" . sql_error(), 37);
         setup::errors_show();
     }
     if (!($version = sgsml_parser::sql_version())) {
         setup::error_add(sprintf("{t}Could not determine database-version.{/t}"), 38);
     }
     $database_min = (int) substr(str_replace(".", "", $databases[SETUP_DB_TYPE][1]), 0, 3);
     if ($version < $database_min) {
         setup::error_add(sprintf("{t}Wrong database-version (%s). Please use at least %s !{/t}", $version, $databases[SETUP_DB_TYPE]), "20" . SETUP_DB_TYPE);
     }
     if (SETUP_DB_TYPE == "pgsql") {
         if (!sql_query("SELECT ''::tsvector;")) {
             setup::error_add("{t}Please install 'tsearch2' for the PostgreSQL database.{/t}\n(Run <postgresql>/share/contrib/tsearch2.sql)\n" . sql_error(), 21);
         }
         if (!sql_query(file_get_contents("modules/core/pgsql.sql"))) {
             setup::error_add("pgsql.sql: " . sql_error(), 50);
         }
     }
     setup::errors_show();
     return $version;
 }
开发者ID:drognisep,项目名称:Simple-Groupware,代码行数:51,代码来源:setup.php


注:本文中的validate::username方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。