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


PHP PMA_addUser函数代码示例

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


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

示例1: testPMAAddUser

 /**
  * Test for PMA_addUser
  *
  * @return void
  */
 public function testPMAAddUser()
 {
     $dbname = 'pma_dbname';
     $username = 'pma_username';
     $hostname = 'pma_hostname';
     $_REQUEST['adduser_submit'] = true;
     $_POST['pred_username'] = 'any';
     $_POST['pred_hostname'] = 'localhost';
     $_POST['pred_password'] = 'keep';
     $_REQUEST['createdb-3'] = true;
     $_REQUEST['userGroup'] = "username";
     $_REQUEST['authentication_plugin'] = 'mysql_native_password';
     list($ret_message, , , $sql_query, $_add_user_error) = PMA_addUser($dbname, $username, $hostname, $dbname, true);
     $this->assertEquals('You have added a new user.', $ret_message->getMessage());
     $this->assertEquals("CREATE USER ''@'localhost' IDENTIFIED WITH mysql_native_password AS '***';" . "GRANT USAGE ON *.* TO ''@'localhost' REQUIRE NONE;" . "GRANT ALL PRIVILEGES ON `pma_dbname`.* TO ''@'localhost';", $sql_query);
     $this->assertEquals(false, $_add_user_error);
 }
开发者ID:netroby,项目名称:phpmyadmin,代码行数:22,代码来源:PMA_server_privileges_test.php

示例2: list

 * only to update the password
 */
if (isset($_REQUEST['change_copy']) && $username == $_REQUEST['old_username'] && $hostname == $_REQUEST['old_hostname']) {
    $response->addHTML(PMA_Message::error(__('Username and hostname didn\'t change.'))->getDisplay());
    $response->isSuccess(false);
    exit;
}
/**
 * Changes / copies a user, part I
 */
list($queries, $password) = PMA_getDataForChangeOrCopyUser();
/**
 * Adds a user
 *   (Changes / copies a user, part II)
 */
list($ret_message, $ret_queries, $queries_for_display, $sql_query, $_add_user_error) = PMA_addUser(isset($dbname) ? $dbname : null, isset($username) ? $username : null, isset($hostname) ? $hostname : null, isset($password) ? $password : null, $cfgRelation['menuswork']);
//update the old variables
if (isset($ret_queries)) {
    $queries = $ret_queries;
    unset($ret_queries);
}
if (isset($ret_message)) {
    $message = $ret_message;
    unset($ret_message);
}
/**
 * Changes / copies a user, part III
 */
if (isset($_REQUEST['change_copy'])) {
    $queries = PMA_getDbSpecificPrivsQueriesForChangeOrCopyUser($queries, $username, $hostname);
}
开发者ID:xtreme-jamil-shamy,项目名称:phpmyadmin-cf,代码行数:31,代码来源:server_privileges.php

示例3: testPMAAddUser

    /**
     * Test for PMA_addUser
     *
     * @return void
     */
    public function testPMAAddUser()
    {
        // Case 1 : Test with Newer version
        $restoreMySQLVersion = "PMANORESTORE";
        if (! PMA_HAS_RUNKIT) {
            $this->markTestSkipped(
                'Cannot redefine constant. Missing runkit extension'
            );
        } else {
            $restoreMySQLVersion = PMA_MYSQL_INT_VERSION;
            runkit_constant_redefine('PMA_MYSQL_INT_VERSION', 50706);
        }

        $dbname = 'pma_dbname';
        $username = 'pma_username';
        $hostname = 'pma_hostname';
        $_REQUEST['adduser_submit'] = true;
        $_POST['pred_username'] = 'any';
        $_POST['pred_hostname'] = 'localhost';
        $_POST['pred_password'] = 'keep';
        $_REQUEST['createdb-3'] = true;
        $_REQUEST['userGroup'] = "username";
        $_REQUEST['authentication_plugin'] = 'mysql_native_password';

        list(
            $ret_message,,, $sql_query,
            $_add_user_error
        ) = PMA_addUser(
            $dbname,
            $username,
            $hostname,
            $dbname,
            true
        );
        $this->assertEquals(
            'You have added a new user.',
            $ret_message->getMessage()
        );
        $this->assertEquals(
            "CREATE USER ''@'localhost' IDENTIFIED WITH mysql_native_password AS '***';"
            . "GRANT USAGE ON *.* TO ''@'localhost' REQUIRE NONE;"
            . "GRANT ALL PRIVILEGES ON `pma_dbname`.* TO ''@'localhost';",
            $sql_query
        );
        $this->assertEquals(
            false,
            $_add_user_error
        );

        if ($restoreMySQLVersion !== "PMANORESTORE") {
            runkit_constant_redefine('PMA_MYSQL_INT_VERSION', $restoreMySQLVersion);
        }


        // Case 2 : Test with older versions
        $restoreMySQLVersion = "PMANORESTORE";
        if (! PMA_HAS_RUNKIT) {
            $this->markTestSkipped(
                'Cannot redefine constant. Missing runkit extension'
            );
        } else {
            $restoreMySQLVersion = PMA_MYSQL_INT_VERSION;
            runkit_constant_redefine('PMA_MYSQL_INT_VERSION', 50506);
        }

        list(
            $ret_message,,, $sql_query,
            $_add_user_error
        ) = PMA_addUser(
            $dbname,
            $username,
            $hostname,
            $dbname,
            true
        );

        $this->assertEquals(
            'You have added a new user.',
            $ret_message->getMessage()
        );
        $this->assertEquals(
            "CREATE USER ''@'localhost';"
            . "GRANT USAGE ON *.* TO ''@'localhost' REQUIRE NONE;"
            . "SET PASSWORD FOR ''@'localhost' = '***';"
            . "GRANT ALL PRIVILEGES ON `pma_dbname`.* TO ''@'localhost';",
            $sql_query
        );
        $this->assertEquals(
            false,
            $_add_user_error
        );

        if ($restoreMySQLVersion !== "PMANORESTORE") {
            runkit_constant_redefine('PMA_MYSQL_INT_VERSION', $restoreMySQLVersion);
        }
//.........这里部分代码省略.........
开发者ID:nijel,项目名称:phpmyadmin,代码行数:101,代码来源:PMA_server_privileges_test.php

示例4: list

}

/**
 * Changes / copies a user, part I
 */
list($queries, $password) = PMA_getDataForChangeOrCopyUser();

/**
 * Adds a user
 *   (Changes / copies a user, part II)
 */
list($ret_message, $ret_queries, $queries_for_display, $sql_query, $_add_user_error)
    = PMA_addUser(
        isset($dbname)? $dbname : null,
        isset($username)? $username : null,
        isset($hostname)? $hostname : null,
        isset($password)? $password : null,
        $cfgRelation['menuswork']
    );
//update the old variables
if (isset($ret_queries)) {
    $queries = $ret_queries;
    unset($ret_queries);
}
if (isset($ret_message)) {
    $message = $ret_message;
    unset($ret_message);
}

/**
 * Changes / copies a user, part III
开发者ID:nijel,项目名称:phpmyadmin,代码行数:31,代码来源:server_privileges.php

示例5: testPMAAddUser

 /**
  * Test for PMA_addUser
  *
  * @return void
  */
 public function testPMAAddUser()
 {
     $dbname = 'pma_dbname';
     $username = 'pma_username';
     $hostname = 'pma_hostname';
     $tablename = 'pma_tablename';
     $password = 'pma_password';
     $_REQUEST['adduser_submit'] = true;
     $_POST['pred_username'] = 'any';
     $_POST['pred_hostname'] = 'localhost';
     $_REQUEST['createdb-3'] = true;
     $_REQUEST['userGroup'] = "username";
     list($ret_message, $ret_queries, $queries_for_display, $sql_query, $_add_user_error) = PMA_addUser($dbname, $username, $hostname, $dbname, true);
     $this->assertEquals('You have added a new user.', $ret_message->getMessage());
     $this->assertEquals("CREATE USER ''@'localhost';GRANT USAGE ON *.* TO ''@'localhost';" . "GRANT ALL PRIVILEGES ON `pma_dbname`.* TO ''@'localhost';", $sql_query);
     $this->assertEquals(false, $_add_user_error);
 }
开发者ID:kfjihailong,项目名称:phpMyAdmin,代码行数:22,代码来源:PMA_server_privileges_test.php


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