當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。