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


PHP client::createDbPass方法代码示例

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


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

示例1: changeSuperAdminPass

 function changeSuperAdminPass()
 {
     if ($this->nname === 'superadmin') {
         $oldpass = getAdminDbPass();
         $newp = client::createDbPass($this->realpass);
         $return = lfile_put_contents("__path_super_pass", $newp);
         if (!$return) {
             log_log("admin_error", "Admin pass change failed  {$last_error}");
             throw new lxException("could_not_change_superadmin_pass", '');
         }
         $return = $sql->setPassword($newp);
         if ($return) {
             $return = lfile_put_contents("__path_super_pass", $oldpass);
             log_log("admin_error", "mysqladmin Failed . {$out}");
             throw new lxException("could_not_change_superadmin_pass", '');
         }
     }
 }
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:18,代码来源:superclientlib.php

示例2: create_mysql_db

function create_mysql_db($type, $opt, $admin_pass)
{
    global $gbl, $sgbl, $login, $ghtml;
    $progname = $sgbl->__var_program_name;
    $db = $sgbl->__var_dbf;
    if (!isset($opt['db-rootuser']) || !isset($opt['db-rootpassword'])) {
        print "Need db Root User and password --db-rootuser, --db-rootpassword \n";
        exit;
    }
    if ($sgbl->__var_database_type === 'mysql') {
        // TODO: REPLACE MYSQL_CONNECT
        // TUT TUT naughty programmer... We are creating the db now XD
        $req = mysqli_connect('localhost', $opt['db-rootuser'], $opt['db-rootpassword']);
    } else {
        if ($sgbl->__var_database_type === 'mssql') {
            $req = mssql_connect("localhost,{$sgbl->__var_mssqlport}");
        } else {
            $req = new PDO("sqlite:{$db}");
        }
    }
    if (!$req) {
        print "Could not Connect to Database on localhost using root user: " . mysqli_connect_error() . "\n";
    }
    //$sqlcm = lfile_get_contents("__path_program_root/httpdocs/sql/init/$type.sql");
    $dp = randomString(9);
    $dbadminpass = client::createDbPass($dp);
    $dbname = $sgbl->__var_dbf;
    $pguser = $sgbl->__var_admin_user;
    if ($sgbl->__var_database_type === 'mysql') {
        @mysqli_query($req, "CREATE DATABASE {$dbname}");
        mysqli_query($req, "GRANT ALL ON {$dbname}.* TO '{$pguser}'@'localhost' IDENTIFIED BY '{$dbadminpass}';");
    } else {
        if ($sgbl->__var_database_type === 'mssql') {
            mssql_query("create database {$dbname};");
            mssql_query("use master ");
            mssql_query("sp_addlogin '{$pguser}', '{$dbadminpass}', '{$dbname}';");
            mssql_query("use {$dbname} ");
            mssql_query("grant all to {$pguser}");
        } else {
        }
    }
    lfile_put_contents("__path_admin_pass", $dbadminpass);
    lxfile_generic_chown("__path_admin_pass", "lxlabs");
}
开发者ID:hypervm-ng,项目名称:hypervm-ng,代码行数:44,代码来源:initlib.php

示例3: create_mysql_db

function create_mysql_db($type, $opt, $admin_pass)
{
    global $gbl, $sgbl, $login, $ghtml;
    $progname = $sgbl->__var_program_name;
    if (!isset($opt['db-rootuser']) || !isset($opt['db-rootpassword'])) {
        print "Need db Root User and password --db-rootuser, --db-rootpassword \n";
        exit;
    }
    if ($sgbl->__var_database_type === 'mysql') {
        $req = mysql_connect('localhost', $opt['db-rootuser'], $opt['db-rootpassword']);
    } else {
        if ($sgbl->__var_database_type === 'mssql') {
            $req = mssql_connect("localhost,{$sgbl->__var_mssqlport}");
        } else {
            $req = new PDO("sqlite:{$sgbl->__var_dbf}");
        }
    }
    if (!$req) {
        print "Could not Connect to Database on localhost using root user\n";
    }
    //$sqlcm = lfile_get_contents("__path_program_root/httpdocs/sql/init/$type.sql");
    $dp = randomString(9);
    $dbadminpass = client::createDbPass($dp);
    $dbname = $sgbl->__var_dbf;
    $pguser = $sgbl->__var_admin_user;
    if ($sgbl->__var_database_type === 'mysql') {
        @mysql_query("create database {$dbname}");
        mysql_query("grant all on {$dbname}.* to '{$pguser}'@'localhost' identified by '{$dbadminpass}';");
    } else {
        if ($sgbl->__var_database_type === 'mssql') {
            mssql_query("create database {$dbname};");
            mssql_query("use master ");
            mssql_query("sp_addlogin '{$pguser}', '{$dbadminpass}', '{$dbname}';");
            mssql_query("use {$dbname} ");
            mssql_query("grant all to {$pguser}");
        } else {
        }
    }
    lfile_put_contents("__path_admin_pass", $dbadminpass);
    lxfile_generic_chown("__path_admin_pass", "lxlabs");
}
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:41,代码来源:initlib.php

示例4: change_db_pass

function change_db_pass()
{
    global $gbl, $sgbl, $login, $ghtml;
    $pass = randomString(10);
    $newp = client::createDbPass($pass);
    $oldpass = lfile_get_contents("__path_admin_pass");
    $username = $sgbl->__var_program_name;
    $sql = new Sqlite(null, "client");
    //$sql->rawQuery("grant all on kloxo.* to kloxo@'localhost' identified by $newp");
    //$sql->rawQuery("grant all on kloxo.* to kloxo@'%' identified by $newp");
    //$return = $sql->setPassword($newp);
    //exec("mysqladmin -u $username -p$oldpass password $newp 2>&1", $out, $return);
    exec("echo 'set Password=Password(\"{$newp}\")' | mysql -u {$username} -p{$oldpass} 2>&1", $out, $return);
    if ($return) {
        $out = implode(" ", $out);
        log_log("admin_error", "mysql change password Failed {$out}");
        throw new lxException("could_not_change_admin_pass", '', $out);
    }
    $return = lfile_put_contents("__path_admin_pass", $newp);
    if (!$return) {
        log_log("admin_error", "Admin pass change failed  {$last_error}");
        throw new lxException("could_not_change_admin_pass", '', $last_error);
    }
}
开发者ID:zseand,项目名称:kloxo,代码行数:24,代码来源:lxlib.php

示例5: slave_get_db_pass

<?php

include_once "htmllib/lib/include.php";
if ($argv[1]) {
    $mysqlpass = $argv[1];
} else {
    $mysqlpass = slave_get_db_pass();
}
$db = $sgbl->__var_dbf;
$username = $sgbl->__var_program_name;
$program = $username;
$newpass = randomString(9);
$newpass = client::createDbPass($newpass);
mysql_connect("localhost", "root", $mysqlpass);
$cmd = "grant all on {$db}.* to {$username}@localhost identified by '{$newpass}'";
print "{$cmd}\n";
mysql_query($cmd);
lfile_put_contents("../etc/conf/{$program}.pass", $newpass);
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:18,代码来源:fixprogrammysql.php


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