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


PHP passwordgenerate函数代码示例

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


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

示例1: linuxAddModUserGenerate

 private function linuxAddModUserGenerate($userName, $password, $protected = false, $deactivate = false)
 {
     $password = $deactivate == false ? $password : passwordgenerate(10);
     $userNameHome = $protected == false ? $this->appServerDetails['userName'] : $this->appServerDetails['userName'] . '/pserver';
     // Check if the user can be found. If not, add it, if yes, edit
     $this->shellScripts['user'] .= 'if [ "`id ' . $userName . ' 2>/dev/null`" == "" ]; then' . "\n";
     $this->shellScripts['user'] .= 'CONFIGUSERID=' . $this->appMasterServerDetails['configUserID'] . "\n";
     $this->shellScripts['user'] .= 'USER=`ls -la /var/run/screen | grep S-' . $userName . ' | head -n 1 | awk \'{print $3}\'`' . "\n";
     $this->shellScripts['user'] .= 'if [ "$USER" != "" -a $USER -eq $USER 2> /dev/null ]; then CONFIGUSERID=$USER; fi' . "\n";
     $this->shellScripts['user'] .= 'USERID=`getent passwd | cut -f3 -d: | sort -un | awk \'BEGIN { id=\'${CONFIGUSERID}\' } $1 == id { id++ } $1 > id { print id; exit }\'`' . "\n";
     $this->shellScripts['user'] .= 'if [ "`ls -la /var/run/screen | awk \'{print $3}\' | grep $USERID`" == "" -a "`grep \\"x:$USERID:\\" /etc/passwd`" == "" ]; then' . "\n";
     $this->shellScripts['user'] .= 'sudo /usr/sbin/useradd -m -p `perl -e \'print crypt("\'' . $password . '\'","Sa")\'` -d ' . $this->removeSlashes($this->appServerDetails['homeDir'] . '/' . $userNameHome) . ' -g ' . $this->appMasterServerDetails['ssh2User'] . ' -s /bin/bash -u $USERID ' . $userName . ' 2>/dev/null' . "\n";
     $this->shellScripts['user'] .= 'else' . "\n";
     $this->shellScripts['user'] .= 'while [ "`ls -la /var/run/screen | awk \'{print $3}\' | grep $USERID`" != "" -o "`grep \\"x:$USERID:\\" /etc/passwd`" != "" ]; do' . "\n";
     $this->shellScripts['user'] .= 'USERID=$[USERID+1]' . "\n";
     $this->shellScripts['user'] .= 'if [ "`ls -la /var/run/screen | awk \'{print $3}\' | grep $USERID`" == "" -a "`grep \\"x:$USERID:\\" /etc/passwd`" == "" ]; then' . "\n";
     $this->shellScripts['user'] .= 'sudo /usr/sbin/useradd -m -p `perl -e \'print crypt("\'' . $password . '\'","Sa")\'` -m -d ' . $this->removeSlashes($this->appServerDetails['homeDir'] . '/' . $userNameHome) . ' -g ' . $this->appMasterServerDetails['ssh2User'] . ' -s /bin/bash -u $USERID ' . $userName . ' 2>/dev/null' . "\n";
     $this->shellScripts['user'] .= 'fi' . "\n";
     $this->shellScripts['user'] .= 'done' . "\n";
     $this->shellScripts['user'] .= 'fi' . "\n";
     $this->addLogline('user.log', 'User ' . $userName . ' added');
     $this->shellScripts['user'] .= 'else' . "\n";
     $this->shellScripts['user'] .= 'sudo /usr/sbin/usermod -p `perl -e \'print crypt("\'' . $password . '\'","Sa")\'` -m -d ' . $this->removeSlashes($this->appServerDetails['homeDir'] . '/' . $userNameHome) . ' ' . $userName . "\n";
     $this->addLogline('user.log', 'User ' . $userName . ' edited');
     $this->shellScripts['user'] .= 'fi' . "\n";
 }
开发者ID:Eun,项目名称:developer,代码行数:26,代码来源:class_app.php

示例2: foreach

             $hostExternalID = $row['externalID'];
             $defaultDns = $row['defaultdns'];
             $vhostTemplate = $row['vhostTemplate'];
             $phpConfigurationMaster = @parse_ini_string($row['phpConfiguration'], true, INI_SCANNER_RAW);
             foreach ($phpConfigurationMaster as $groupName => $array) {
                 reset($phpConfigurationMaster[$groupName]);
                 $phpConfiguration[$groupName] = key($phpConfigurationMaster[$groupName]);
             }
         }
         $phpConfiguration = @json_encode($phpConfiguration);
         if (!isid($webMasterID, 10)) {
             $success['false'][] = 'No free host';
         }
     }
     if (!isset($success['false'])) {
         $password = (isset($data['password']) and strlen($data['password']) > 0) ? $data['password'] : passwordgenerate(10);
         $query = $sql->prepare("INSERT INTO `webVhost` (`externalID`,`webMasterID`,`userID`,`active`,`hdd`,`ftpPassword`,`phpConfiguration`,`jobPending`,`resellerID`) VALUES (?,?,?,?,?,AES_ENCRYPT(?,?),?,'Y',?)");
         $query->execute(array($externalServerID, $webMasterID, $localUserLookupID, $active, $hdd, $password, $aeskey, $phpConfiguration, $resellerID));
         $localServerID = (int) $sql->lastInsertId();
         $ftpUser = 'web-' . $localServerID;
         if ($defaultDns == $dns or $dns == '') {
             $dns = str_replace('..', '.', $ftpUser . '.' . $defaultDns);
         }
         $query = $sql->prepare("UPDATE `webVhost` SET `defaultDomain`=? WHERE `webVhostID`=? AND `resellerID`=? LIMIT 1");
         $query->execute(array($dns, $localServerID, $resellerID));
         $query = $sql->prepare("UPDATE `webVhost` SET `ftpUser`=? WHERE `webVhostID`=? AND `resellerID`=? LIMIT 1");
         $query->execute(array($ftpUser, $localServerID, $resellerID));
         $query = $sql->prepare("INSERT INTO `jobs` (`api`,`type`,`affectedID`,`invoicedByID`,`hostID`,`userID`,`name`,`status`,`date`,`action`,`extraData`,`resellerid`) VALUES ('A','wv',?,?,?,?,?,NULL,NOW(),'ad','',?)");
         $query->execute(array($localServerID, $resellerID, $webMasterID, $localUserLookupID, $dns, $resellerID));
     }
 }
开发者ID:nightcore125,项目名称:developer,代码行数:31,代码来源:api_web.php

示例3: header

                                    }
                                }
                            }
                            $i++;
                            $i2++;
                        }
                    }
                }
                header("Content-type:image/png");
                imagepng($img);
            }
        }
    }
} else {
    if (!$ui->st('img', 'get')) {
        $randompass = passwordgenerate(4);
        $_SESSION['captcha'] = md5($randompass);
        $captcha = $randompass;
        $bildhoehe = 20;
        $bildbreite = 40;
        $bild = imagecreate($bildbreite, $bildhoehe);
        imagecolorallocate($bild, 255, 255, 255);
        $text = imagecolorallocate($bild, 0, 0, 0);
        $font = 20;
        $a = 2;
        $x = floor($bildbreite / strlen($captcha)) - 0;
        $captchaLength = strlen($captcha);
        for ($b = 0; $b < $captchaLength; $b++) {
            $c = mt_rand(0, 2);
            imagestring($bild, $font, $a, $c, $captcha[$b], $text);
            $a = $a + $x;
开发者ID:nightcore125,项目名称:developer,代码行数:31,代码来源:images.php

示例4: md5

    if (count($error) > 0) {
        $token = md5(passwordgenerate(32));
        $_SESSION['token'] = $token;
        $comments = str_replace('<br />', '', $comments);
    } else {
        $comments = $name . ' (' . $email . '):<br />' . $comments;
        $query = $sql->prepare("SELECT `email_setting_value` FROM `settings_email` WHERE `reseller_id`=? AND `email_setting_name`='email' LIMIT 1");
        $query->execute(array($reseller_id));
        if (sendmail('contact', $name, $comments, $query->fetchColumn())) {
            unset($error);
            $success = true;
        } else {
            $error[] = 'Sending the mail failed';
            $token = md5(passwordgenerate(32));
            $_SESSION['token'] = $token;
        }
    }
} else {
    $token = md5(passwordgenerate(32));
    $_SESSION['token'] = $token;
}
$page_data->title = $page_sprache->contact;
$page_data->setCanonicalUrl($s);
// https://github.com/easy-wi/developer/issues/62
$langLinks = array();
foreach ($languages as $l) {
    $tempLanguage = getlanguagefile('page', $l, 0);
    $langLinks[$l] = $page_data->seo == 'Y' ? szrp($tempLanguage->{$s}) : '?s=' . $s;
}
$page_data->langLinks($langLinks);
$template_file = 'contact.tpl';
开发者ID:nightcore125,项目名称:developer,代码行数:31,代码来源:page_contact.php

示例5: VALUES

     $query = $sql->prepare("INSERT INTO `userdata` (`creationTime`,`updateTime`,`accounttype`,`active`,`cname`,`vname`,`name`,`mail`,`salt`,`phone`,`handy`,`fax`,`city`,`cityn`,`street`,`streetn`,`salutation`,`birthday`,`country`,`fdlpath`,`mail_backup`,`mail_gsupdate`,`mail_securitybreach`,`mail_serverdown`,`mail_ticket`,`mail_vserver`,`externalID`,`sourceSystemID`,`resellerid`) VALUES (NOW(),NOW(),'u',?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
     $query->execute(array($active, $tmpName, $vname, $name, $email, $salt, $phone, $handy, $fax, $city, $cityn, $street, $streetn, $salutation, $birthday, $country, $fdlpath, $mail_backup, $mail_gsupdate, $mail_securitybreach, $mail_serverdown, $mail_ticket, $mail_vserver, $externalID, json_encode(array('A' => $apiIP)), $resellerID));
     $localID = $sql->lastInsertId();
     if (isid($localID, 10)) {
         $insert = true;
     }
     if (isset($prefix)) {
         $username = $prefix . $localID;
     }
 } else {
     if (!isset($success['false'])) {
         $success['false'][] = 'No usergroup available';
     }
 }
 if (!isset($success) and isset($insert) and $insert == true) {
     $password = (!isset($data['password']) or in_array($data['password'], $bad)) ? passwordgenerate(10) : $data['password'];
     $newHash = passwordCreate($name, $password);
     if (is_array($newHash)) {
         $query = $sql->prepare("UPDATE `userdata` SET `cname`=?,`security`=?,`salt`=? WHERE `id`=? LIMIT 1");
         $query->execute(array($username, $newHash['hash'], $newHash['salt'], $localID));
     } else {
         $query = $sql->prepare("UPDATE `userdata` SET `cname`=?,`security`=? WHERE `id`=? LIMIT 1");
         $query->execute(array($username, $newHash, $localID));
     }
     $query = $sql->prepare("INSERT INTO `userdata_groups` (`userID`,`groupID`,`resellerID`) VALUES (?,?,?)");
     foreach ($userGroupIDs as $groupID) {
         $query->execute(array($localID, $groupID, $resellerID));
     }
 } else {
     if (!isset($success)) {
         $success['false'][] = 'Could not write user to database';
开发者ID:Eun,项目名称:developer,代码行数:31,代码来源:api_users.php

示例6: EasyWiFTP

        $query->execute(array($id, $resellerLockupID));
        $ftp = new EasyWiFTP($appServer->appMasterServerDetails['ssh2IP'], $appServer->appMasterServerDetails['ftpPort'], $appServer->appServerDetails['userNameExecute'], $appServer->appServerDetails['ftpPasswordExecute']);
        if ($ftp->loggedIn) {
            $ftp->downloadToTemp($appServer->appServerDetails['absoluteFTPPath'], 0, $files);
        }
        $query = $sql->prepare("UPDATE `gsswitch` SET `protected`=? WHERE `id`=? LIMIT 1");
        $query->execute(array($protected, $id));
        $appServer->getAppServerDetails($id);
        if ($ftp->loggedIn) {
            $ftp->createSecondFTPConnect($appServer->appMasterServerDetails['ssh2IP'], $appServer->appMasterServerDetails['ftpPort'], $appServer->appServerDetails['userNameExecute'], $appServer->appServerDetails['ftpPasswordExecute']);
            if ($ftp->secondLoggedIn) {
                $ftp->uploadFileFromTemp($appServer->appServerDetails['absoluteFTPPath']);
            }
        }
        if ($appServer->appServerDetails['protectionModeStarted'] == 'Y') {
            $query = $sql->prepare("UPDATE `gsswitch` SET `ppassword`=AES_ENCRYPT(?,?),`psince`=NOW() WHERE `id`=? LIMIT 1");
            $query->execute(array(passwordgenerate(10), $aeskey, $id));
            $appServer->getAppServerDetails($id);
            $appServer->userCud('add');
            $appServer->removeApp(array($appServer->appServerDetails['app']['templateChoosen']));
            $appServer->addApp();
        }
        $ftp = null;
        $appServer->startApp();
        $appServer->execute();
        $insertlog->execute();
        if (isset($dbConnect['debug']) and $dbConnect['debug'] == 1) {
            $template_file .= '<br><pre>' . implode("\r\n", $appServer->debug()) . '</pre>';
        }
    }
}
开发者ID:nightcore125,项目名称:developer,代码行数:31,代码来源:userpanel_protectionmode.php

示例7: passwordgenerate

$autoRestart = $ui->active('autoRestart', 'post') ? $ui->active('autoRestart', 'post') : 'N';
$active = $ui->active('active', 'post') ? $ui->active('active', 'post') : 'Y';
$backup = $ui->active('backup', 'post') ? $ui->active('backup', 'post') : 'Y';
$password = $ui->active('password', 'post') ? $ui->active('password', 'post') : 'Y';
$lendserver = $ui->active('lendserver', 'post') ? $ui->active('lendserver', 'post') : 'Y';
$forcebanner = $ui->active('forcebanner', 'post') ? $ui->active('forcebanner', 'post') : 'Y';
$forcebutton = $ui->active('forcebutton', 'post') ? $ui->active('forcebutton', 'post') : 'Y';
$forceservertag = $ui->active('forceservertag', 'post') ? $ui->active('forceservertag', 'post') : 'Y';
$forcewelcome = $ui->active('forcewelcome', 'post') ? $ui->active('forcewelcome', 'post') : 'Y';
$flexSlotsPercent = $ui->id('flexSlotsPercent', 3, 'post');
$flexSlotsFree = $ui->id('flexSlotsFree', 11, 'post');
$oldSlots = 0;
if ($password == 'N') {
    $initialpassword = '';
} else {
    $initialpassword = $ui->password('initialpassword', 50, 'post') ? $ui->password('initialpassword', 50, 'post') : passwordgenerate(10);
}
// CSFR protection with hidden tokens. If token(true) returns false, we likely have an attack
if ($ui->w('action', 4, 'post') and !token(true)) {
    unset($header, $text);
    $errors = array('token' => $spracheResponse->token);
} else {
    $errors = array();
}
if ($ui->st('d', 'get') == 'ad' and is_numeric($licenceDetails['lVo']) and $licenceDetails['lVo'] > 0 and $licenceDetails['left'] > 0 and !is_numeric($licenceDetails['left'])) {
    $template_file = $gsprache->licence;
    // Add and modify entries. Same validation can be used.
} else {
    if ($ui->st('d', 'get') == 'ad' or $ui->st('d', 'get') == 'md') {
        // Add jQuery plugin chosen to the header
        $htmlExtraInformation['css'][] = '<link href="css/default/chosen/chosen.min.css" rel="stylesheet" type="text/css">';
开发者ID:nightcore125,项目名称:developer,代码行数:31,代码来源:voice.php

示例8: passwordgenerate

$name = $ui->names('name', 255, 'post');
$vname = $ui->names('vname', 255, 'post');
$mail = $ui->ismail('mail', 'post');
$phone = $ui->phone('phone', 'post');
$handy = $ui->phone('handy', 'post');
$city = $ui->names('city', 50, 'post');
$cityn = $ui->id('cityn', 6, 'post');
$street = $ui->names('street', 50, 'post');
$streetn = $ui->streetNumber('streetn', 'post');
$country = $ui->st('country', 'post');
$fax = $ui->phone('fax', 'post');
$fdlpath = $ui->url('fdlpath', 'post');
$active = $ui->active('active', 'post') ? $ui->active('active', 'post') : 'Y';
$useractive = $ui->active('useractive', 'post') ? $ui->active('useractive', 'post') : 'Y';
$accountType = $ui->smallletters('accounttype', 1, 'post') ? $ui->smallletters('accounttype', 1, 'post') : '';
$password = $ui->password('password', 255, 'post') ? $ui->password('password', 255, 'post') : passwordgenerate(10);
$birthday = date('Y-m-d', strtotime($ui->isDate('birthday', 'post')));
$maxuser = $ui->id('maxuser', 10, 'post') ? $ui->id('maxuser', 10, 'post') : 0;
$maxgserver = $ui->id('maxgserver', 10, 'post') ? $ui->id('maxgserver', 10, 'post') : 0;
$maxvoserver = $ui->id('maxvoserver', 10, 'post') ? $ui->id('maxvoserver', 10, 'post') : 0;
$maxvserver = ($ui->id('maxvserver', 10, 'post') and $easywiModules['ro']) ? $ui->id('maxvserver', 10, 'post') : 0;
$maxdedis = ($ui->id('maxdedis', 10, 'post') and $easywiModules['ro']) ? $ui->id('maxdedis', 10, 'post') : 0;
$maxuserram = ($ui->id('maxuserram', 255, 'post') and $easywiModules['ro']) ? $ui->id('maxuserram', 255, 'post') : 0;
$maxusermhz = ($ui->id('maxusermhz', 255, 'post') and $easywiModules['ro']) ? $ui->id('maxusermhz', 255, 'post') : 0;
$mail_backup = $ui->active('mail_backup', 'post') ? $ui->active('mail_backup', 'post') : 'N';
$mail_serverdown = $ui->active('mail_serverdown', 'post') ? $ui->active('mail_serverdown', 'post') : 'N';
$mail_ticket = $ui->active('mail_ticket', 'post') ? $ui->active('mail_ticket', 'post') : 'N';
$mail_gsupdate = $ui->active('mail_gsupdate', 'post') ? $ui->active('mail_gsupdate', 'post') : 'N';
$mail_securitybreach = $ui->active('mail_securitybreach', 'post') ? $ui->active('mail_securitybreach', 'post') : 'N';
$mail_vserver = $ui->active('mail_vserver', 'post') ? $ui->active('mail_vserver', 'post') : 'N';
if ($accountType == 'a' and $ui->username('acname', 255, 'post')) {
开发者ID:nightcore125,项目名称:developer,代码行数:31,代码来源:user.php

示例9: setInactive

 public function setInactive($vhostID)
 {
     $this->changePassword($vhostID, passwordgenerate(10));
     $this->removeVhost($vhostID, false);
     $this->vhostData = false;
 }
开发者ID:nightcore125,项目名称:developer,代码行数:6,代码来源:class_httpd.php

示例10: passwordgenerate

            $displayToUser .= "<div class='alert alert-success'>{$v}</div>";
        }
    }
    if (count($systemCheckError) == 0) {
        $displayToUser .= "<div class='pager'><a href='?step=2{$languageGetParameter}' class='pull-right'><span class='btn btn-primary btn-lg'>{$languageObject->continue}</span></a></div>";
    }
} else {
    if (count($systemCheckError) > 0) {
    }
}
if ($currentStep == 2 and count($systemCheckError) == 0) {
    $host = 'localhost';
    $db = '';
    $user = '';
    $pwd = '';
    $aeskey = passwordgenerate(20);
    if (file_exists(EASYWIDIR . '/stuff/config.php')) {
        require_once EASYWIDIR . '/stuff/config.php';
    }
    if (file_exists(EASYWIDIR . '/stuff/keyphrasefile.php')) {
        require_once EASYWIDIR . '/stuff/keyphrasefile.php';
    }
    $displayToUser = "\n<form class='form-horizontal' role='form' action='install.php?step=3{$languageGetParameter}' method='post'>\n  <div class='form-group'>\n    <label for='inputHost' class='col-sm-2 control-label'>{$languageObject->host}</label>\n    <div class='col-sm-10'>\n      <input type='text' class='form-control' id='inputHost' name='host' value='{$host}' required>\n    </div>\n  </div>\n  <div class='form-group'>\n    <label for='inputDB' class='col-sm-2 control-label'>{$languageObject->db}</label>\n    <div class='col-sm-10'>\n      <input type='text' class='form-control' id='inputDB' name='db' value='{$db}' required>\n    </div>\n  </div>\n  <div class='form-group'>\n    <label for='inputUser' class='col-sm-2 control-label'>{$languageObject->user}</label>\n    <div class='col-sm-10'>\n      <input type='text' class='form-control' id='inputUser' name='user' value='{$user}' required>\n    </div>\n  </div>\n  <div class='form-group'>\n    <label for='inputPassword' class='col-sm-2 control-label'>{$languageObject->passw_1}</label>\n    <div class='col-sm-10'>\n      <input type='password' class='form-control' id='inputPassword' name='pwd' value='{$pwd}' required>\n    </div>\n  </div>\n  <div class='form-group'>\n    <label for='inputAESKey' class='col-sm-2 control-label'>{$languageObject->aeskey}</label>\n    <div class='col-sm-10'>\n      <input type='text' class='form-control' id='inputAESKey' name='aeskey' value='{$aeskey}' required>\n      <p class='help-block'>{$languageObject->aeskey2}</p>\n      <p class='help-block'>{$languageObject->aeskey3}</p>\n    </div>\n  </div>\n  <div class='form-group'>\n    <div class='col-sm-offset-2 col-sm-10'>\n      <button type='submit' class='btn btn-primary btn-lg pull-right'>{$languageObject->continue}</button>\n    </div>\n  </div>\n</form>\n";
} else {
    if ($currentStep > 2 and count($systemCheckError) == 0) {
        if ($currentStep == 3 and isset($_POST['db'])) {
            try {
                $sql = new PDO("mysql:host={$_POST['host']};dbname={$_POST['db']}", $_POST['user'], $_POST['pwd'], array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
                $sql->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
                $configFp = @fopen(EASYWIDIR . '/stuff/config.php', "w+");
                if ($configFp) {
开发者ID:nightcore125,项目名称:developer,代码行数:31,代码来源:install.php

示例11: while

     if (isset($data['port4']) and checkPorts(array($data['port4']), $ports) === true) {
         $port = $data['port'];
     }
     while (in_array($port4, $ports)) {
         $port4 += $portStep;
     }
 }
 if ($portMax > 4) {
     if (isset($data['port5']) and checkPorts(array($data['port5']), $ports) === true) {
         $port = $data['port'];
     }
     while (in_array($port5, $ports)) {
         $port5 += $portStep;
     }
 }
 $initialpassword = (isset($data['initialpassword']) and wpreg_check($data['initialpassword'], 50) and strlen($data['initialpassword']) > 1) ? $data['initialpassword'] : passwordgenerate(10);
 $taskset = (isset($data['taskset']) and active_check($data['taskset'])) ? $data['taskset'] : 'N';
 $eacallowed = (isset($data['eacallowed']) and active_check($data['eacallowed'])) ? $data['eacallowed'] : 'N';
 $brandname = (isset($data['brandname']) and active_check($data['brandname'])) ? $data['brandname'] : 'N';
 $tvenable = (isset($data['tvenable']) and active_check($data['tvenable'])) ? $data['tvenable'] : 'N';
 $pallowed = (isset($data['pallowed']) and active_check($data['pallowed'])) ? $data['pallowed'] : 'N';
 $autoRestart = (isset($data['autoRestart']) and active_check($data['autoRestart'])) ? $data['autoRestart'] : 'Y';
 $minram = (isset($data['minram']) and isid($data['minram'], 10)) ? $data['minram'] : '';
 $maxram = (isset($data['maxram']) and isid($data['maxram'], 10)) ? $data['maxram'] : '';
 $hdd = (isset($quotaActive) and $quotaActive == 'Y' and isset($data['hdd']) and isid($data['hdd'], 10)) ? $data['maxram'] : 0;
 if (isset($data['coreCount']) and $data['coreCount'] > 0 and isset($calculatedCores)) {
     $cores = $calculatedCores;
 } else {
     $cores = (isset($data['cores']) and cores($data['cores'])) ? $data['cores'] : '';
 }
 if (isset($data['installGames']) and wpreg_check($data['installGames'], 1)) {
开发者ID:nightcore125,项目名称:developer,代码行数:31,代码来源:api_gserver.php

示例12: printText

     } else {
         if (json_encode(array('I' => $row['importID'])) == $sourceSystemID and getParam('externalID') == $externalID) {
             printText('Gameserver found but update skipped since import only mode. Address: ' . getParam('ip') . ':' . getParam('port') . ' (' . getParam('shorten') . ')');
         } else {
             printText('Gameserver found but update skipped because source system differ. Address: ' . getParam('ip') . ':' . getParam('port') . ' (' . getParam('shorten') . ')');
         }
     }
 } else {
     unset($internalUserID, $customer);
     $query4->execute(array(json_encode(array('I' => $row['importID'])), getParam('belongsToID'), $resellerID));
     foreach ($query4->fetchAll(PDO::FETCH_ASSOC) as $row2) {
         $internalUserID = $row2['id'];
         $customer = $row2['cname'];
     }
     if (isset($internalUserID) and isset($customer) and isid($internalUserID, 11)) {
         $passwordGenerate = passwordgenerate(10);
         $query5->execute(array($passwordGenerate, $aeskey, $internalUserID, $gameRootIPs[$arrayIP]['id'], getParam('ip'), getParam('port'), getParam('port2'), getParam('slots'), $taskset, $core, getParam('protectionMode'), json_encode(array('I' => $row['importID'])), getParam('externalID'), $resellerID));
         $switchID = $sql->lastInsertId();
         $tickrate = getParam('tickrate') > 0 ? getParam('tickrate') : 66;
         $startMap = strlen(getParam('startMap')) > 0 ? getParam('startMap') : $defaultMap;
         $query6->execute(array($tickrate, $startMap, $switchID, $servertypeID, $resellerID));
         $query7->execute(array($sql->lastInsertId(), $switchID));
         $ftpConnectString = 'ftp://' . str_replace('//', '/', getParam('ip') . ':' . $gameRootIPs[$arrayIP]['ftpPort'] . '/' . getParam('path') . '/' . $servertypeModFolder);
         $appServer = new AppServer($gameRootIPs[$arrayIP]['id']);
         $appServer->getAppServerDetails($switchID);
         $appServer->migrateToEasyWi(array('user' => getParam('ftpUser'), 'password' => getParam('ftpPass'), 'path' => '/' . getParam('path') . '/' . $servertypeModFolder, 'connectString' => $ftpConnectString), getParam('shorten'), $servertypeModFolder);
         $appServer->execute();
         printText('Import Gameserver. Address: ' . getParam('ip') . ':' . getParam('port') . '. And shorten:' . getParam('shorten'));
     } else {
         printText('Error: Import skipped since no user with external userID ' . getParam('belongsToID') . ' for gameserver with address: ' . getParam('ip') . ':' . getParam('port') . ' and shorten:' . getParam('shorten'));
     }
开发者ID:nightcore125,项目名称:developer,代码行数:31,代码来源:cloud.php

示例13: unset

     if (!in_array($row['servertype'], $gameIDs)) {
         $gamesToBeRemoved[$row['servertype']] = $row['shorten'];
     }
     // Avoid overhead with adding server types during modify operations
     if (isset($gamesToBeInstalled[$row['servertype']])) {
         unset($gamesToBeInstalled[$row['servertype']]);
         unset($gameDetails[$row['servertype']]);
         $installedGames[] = $row['id'];
     }
 }
 $gamesRemoveAmount = count($gamesToBeRemoved);
 $gamesAmount = count($gamesToBeInstalled);
 // Make the inserts or updates define the log entry and get the affected rows from insert
 if ($ui->st('action', 'post') == 'ad') {
     $query = $sql->prepare("INSERT INTO `gsswitch` (`active`,`hdd`,`taskset`,`cores`,`userid`,`pallowed`,`eacallowed`,`lendserver`,`serverip`,`rootID`,`homeLabel`,`tvenable`,`port`,`port2`,`port3`,`port4`,`port5`,`minram`,`maxram`,`slots`,`war`,`brandname`,`autoRestart`,`ftppassword`,`ppassword`,`resellerid`,`serverid`,`stopped`,`externalID`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,AES_ENCRYPT(?,?),AES_ENCRYPT(?,?),?,1,'Y',?)");
     $query->execute(array($active, $hdd, $ui->active('taskset', 'post'), $usedCores, $userID, $protectionAllowed, $eacAllowed, $lendServer, $ip, $rootID, $homeLabel, $tvEnable, $port, $ui->port('port2', 'post'), $ui->port('port3', 'post'), $ui->port('port4', 'post'), $ui->port('port5', 'post'), $minRam, $maxRam, $slots, $war, $brandname, $autoRestart, $ftpPassword, $aeskey, passwordgenerate(10), $aeskey, $resellerLockupID, $ui->externalID('externalID', 'post')));
     $id = $sql->lastInsertId();
     $rowCount += $query->rowCount();
     $loguseraction = '%add% %gserver% ' . $ip . ':' . $port;
 }
 // Insert new games
 $query = $sql->prepare("INSERT INTO `serverlist` (`servertype`,`anticheat`,`switchID`,`fps`,`map`,`mapGroup`,`cmd`,`modcmd`,`owncmd`,`tic`,`gamemod`,`gamemod2`,`userfps`,`usertick`,`usermap`,`user_uploaddir`,`upload`,`uploaddir`,`resellerid`) VALUES (?,1,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,AES_ENCRYPT(?,?),?)");
 foreach ($gameDetails as $gameID => $gameValues) {
     $query->execute(array($gameID, $id, $ui->id('fps', 6, 'post', $gameID), $ui->mapname('map', 'post', $gameID), $ui->mapname('mapGroup', 'post', $gameID), $ui->startparameter('cmd', 'post', $gameID), $gameValues['modCmd'], $ui->active('ownCmd', 'post', $gameID), $ui->id('tic', 5, 'post', $gameID), $gameValues['gamemod'], $gameValues['gamemod2'], $ui->active('userFps', 'post', $gameID), $ui->active('userTick', 'post', $gameID), $ui->active('userMap', 'post', $gameID), $ui->active('userUploadDir', 'post', $gameID), $ui->id('upload', 1, 'post', $gameID), $ui->url('uploadDir', 'post', $gameID), $aeskey, $resellerLockupID));
     $insertedServerIDs[] = $sql->lastInsertId();
     $rowCount += $query->rowCount();
 }
 // Updating the serverlist if not set to be added, we need to run the update
 $query = $sql->prepare("UPDATE `serverlist` SET `fps`=?,`map`=?,`mapGroup`=?,`cmd`=?,`owncmd`=?,`tic`=?,`userfps`=?,`usertick`=?,`usermap`=?,`user_uploaddir`=?,`upload`=?,`uploaddir`=AES_ENCRYPT(?,?) WHERE `switchID`=? AND `servertype`=? AND `resellerid`=? LIMIT 1");
 foreach ($gameIDs as $gameID) {
     if (!isset($gameDetails[$gameID])) {
开发者ID:nightcore125,项目名称:developer,代码行数:31,代码来源:gameserver.php

示例14: passwordgenerate

             $max_connections_per_hour = $row['max_connections_per_hour'];
             $max_userconnections_per_hour = $row['max_userconnections_per_hour'];
         }
         if (!isset($hostID)) {
             $success['false'][] = 'No free host';
         }
     }
     if (!isset($success['false'])) {
         $password = passwordgenerate(10);
         $query = $sql->prepare("INSERT INTO `mysql_external_dbs` (`active`,`sid`,`uid`,`password`,`ips`,`manage_host_table`,`max_queries_per_hour`,`max_updates_per_hour`,`max_connections_per_hour`,`max_userconnections_per_hour`,`externalID`,`resellerid`) VALUES (?,?,?,AES_ENCRYPT(?,?),?,?,?,?,?,?,?,?)");
         $query->execute(array($active, $hostID, $localUserLookupID, $password, $aeskey, '', $manage_host_table, $max_queries_per_hour, $max_updates_per_hour, $max_connections_per_hour, $max_userconnections_per_hour, $externalServerID, $resellerID));
         $localID = $sql->lastInsertId();
         $dbname = 'sql' . $localID;
         if ($query->rowCount() > 0) {
             if ($active == 'N') {
                 $password = passwordgenerate(20);
             }
             $query = $sql->prepare("UPDATE `mysql_external_dbs` SET `dbname`=?,`password`=AES_ENCRYPT(?,?) WHERE `id`=? AND `resellerid`=? LIMIT 1");
             $query->execute(array($dbname, $password, $aeskey, $localID, $resellerID));
             $query = $sql->prepare("UPDATE `jobs` SET `status`='2' WHERE `type`='my' AND (`status` IS NULL OR `status`='1') AND `affectedID`=? and `resellerID`=?");
             $query->execute(array($localID, $resellerID));
             $query = $sql->prepare("INSERT INTO `jobs` (`api`,`type`,`hostID`,`invoicedByID`,`affectedID`,`userID`,`name`,`status`,`date`,`action`,`resellerid`) VALUES ('A','my',?,?,?,?,?,NULL,NOW(),'ad',?)");
             $query->execute(array($hostID, $resellerID, $localID, $localUserLookupID, $dbname, $resellerID));
         } else {
             $success['false'][] = 'Could not write database to database';
         }
     }
 } else {
     if (!isset($success['false'])) {
         $active = active_check($data['active']);
         $identifyUserBy = $data['identify_user_by'];
开发者ID:nightcore125,项目名称:developer,代码行数:31,代码来源:api_mysql.php

示例15: VALUES

             $query = $sql->prepare("INSERT INTO `userdata` (`cname`,`security`,`mail`,`accounttype`,`resellerid`) VALUES (?,?,?,'u',?)");
             $query->execute(array($ui->username("{$lookUp}-username", 50, 'post'), $newHash, $ui->ismail("{$lookUp}-email", 'post'), $reseller_id));
         }
         $query = $sql->prepare("SELECT `id` FROM `userdata` WHERE `cname`=? AND `mail`=? AND `resellerid`=? ORDER BY `id` DESC LIMIT 1");
         $query->execute(array($ui->username("{$lookUp}-username", 50, 'post'), $ui->ismail("{$lookUp}-email", 'post'), $reseller_id));
         while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
             $customer = $row['id'];
             $cnamenew = $ui->username("{$lookUp}-username", 50, 'post');
             sendmail('emailuseradd', $customer, $cnamenew, $initialpassword);
         }
     }
 } else {
     $cldbid = rand(1, 100) . '.' . rand(1, 100);
     $cnamenew = $prefix . $cldbid;
     $query = $sql->prepare("INSERT INTO `userdata` (`cname`,`security`,`mail`,`accounttype`,`resellerid`) VALUES (?,?,?,'u',?)");
     $query->execute(array($cnamenew, passwordgenerate(10), 'ts3@import.mail', $reseller_id));
     $query = $sql->prepare("SELECT `id` FROM `userdata` WHERE `cname`=? AND `mail`='ts3@import.mail' ORDER BY `id` DESC LIMIT 1");
     $query->execute(array($cnamenew));
     while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
         $customer = $row['id'];
         $cnamenew = $prefix . $customer;
     }
     $query = $sql->prepare("UPDATE `userdata` SET `cname`=? WHERE `id`=? AND `resellerid`=? LIMIT 1");
     $query->execute(array($cnamenew, $customer, $reseller_id));
 }
 if ($usernew == true) {
     $query = $sql->prepare("SELECT `id` FROM `usergroups` WHERE `active`='Y' AND `defaultgroup`='Y' AND `grouptype`='u' AND `resellerid`=? LIMIT 1");
     $query->execute(array($reseller_id));
     $groupID = $query->fetchColumn();
     $query = $sql->prepare("UPDATE `userdata` SET `usergroup`=? WHERE id=? AND `resellerid`=? LIMIT 1");
     $query->execute(array($groupID, $customer, $reseller_id));
开发者ID:nightcore125,项目名称:developer,代码行数:31,代码来源:voice_tsdns.php


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