• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP getKey函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getArrOut

function getArrOut($calc, $count)
{
    $output = [];
    $calcOut = ['a' => 0, 'b' => 0, 'c' => 0];
    $vesIn = getVes($calc);
    for ($i = 1; $i <= $count; $i++) {
        $keyCalc = getKey($calc, $vesIn, $calcOut);
        foreach ($calc as $key => $arrin) {
            if ($keyCalc == $key) {
                $calcOut[$key] = $calcOut[$key] + 1;
            }
        }
    }
    $output['calc'] = $calcOut;
    $output['ves'] = $vesIn;
    $output['vesout'] = getVes($calcOut);
    return $output;
}
开发者ID:Victor-pvt,项目名称:test-al,代码行数:18,代码来源:task2php.php


示例2: getvideo

function getvideo($id, $pid = 2)
{
    $hz = '_letv';
    $pidarrs[] = '350';
    $pidarrs[] = '1000';
    $pidarrs[] = '720p';
    $stime = 'http://api.letv.com/time?tn=0.' . time();
    $str = get_curl_contents($stime);
    $t = preg_match('|{"stime":(\\d+)}|', $str, $matchs) ? $matchs[1] : false;
    $content = get_curl_contents('http://api.letv.com/mms/out/video/play?id=' . $id . '&platid=1&splatid=101&domain=http://www.letv.com&tkey=' . getKey($t), 0, 0, 1);
    $data = preg_match('~<playurl><!\\[cdata\\[(.*)\\]\\]></playurl>~iUs', $content, $matchs) ? $matchs[1] : false;
    $json = json_decode($data);
    $pido = '';
    if (strpos($data, '"720p"')) {
        $pido = '3';
    }
    if (!$pido) {
        if (strpos($data, '"1000"')) {
            $pido = '2';
        }
    }
    if (!$pido) {
        $pido = '1';
    }
    switch ($pido) {
        case '1':
            $qvars = __BQ__ . '_' . $id . $hz;
            break;
        case '2':
            $qvars = __BQ__ . '_' . $id . $hz . '|' . __GQ__ . '_' . $id . $hz;
            break;
        case '3':
            $qvars = __BQ__ . '_' . $id . $hz . '|' . __GQ__ . '_' . $id . $hz . '|' . __CQ__ . '_' . $id . $hz;
            break;
        default:
            $qvars = $id . $hz;
            break;
    }
    $pid = min($pid, $pido);
    $dispatch = $json->dispatch->{$pidarrs}[$pid - 1];
    $urllist['urls'][0]['url'] = str_replace('tss=ios', 'tss=no', $dispatch[0]);
    $urllist['vars'] = '{h->1}{a->' . $qvars . '}{f->' . __HOSTURL__ . '?url=[$pat' . ($pid - 1) . ']}';
    return $urllist;
}
开发者ID:areszn,项目名称:wordpress,代码行数:44,代码来源:LetvModel.php


示例3: getLoginJSONP

function getLoginJSONP($type)
{
    require_once "../leader/jsupport.php";
    $success = false;
    $username = "";
    $key = "";
    //Ignore any messages from the login system that may corrupt our JSON
    ob_start();
    if (array_key_exists("username", $_COOKIE) && array_key_exists("key", $_COOKIE)) {
        //We may have saved these via javascript. Try loading them
        $username = strtolower($_COOKIE["username"]);
        $key = $_COOKIE["key"];
        $success = true;
    } else {
        if (checkPostLogin() == 7) {
            //Can we log in with leaderboards?
            $username = strtolower(getPostValue("username"));
            $key = getKey($username);
            $success = true;
        } else {
            //Nope
            $success = false;
        }
    }
    ob_end_clean();
    //Return their key formatted as specified
    if ($success) {
        if ($type === "JS") {
            return "webchat.setUser(\"{$username}\", \"{$key}\", \"true\"); webchat.connect();";
        } else {
            if ($type === "JSON") {
                return json_encode(array("success" => true, "username" => $username, "key" => $key));
            }
        }
    } else {
        if ($type === "JS") {
            return "webchat.enableLogin(true); webchat.setLoginStatus(\"No Saved Login Found\");";
        } else {
            if ($type === "JSON") {
                return json_encode(array("success" => false));
            }
        }
    }
}
开发者ID:PlatinumTeam,项目名称:MBWebchat-Client,代码行数:44,代码来源:user.php


示例4: getCompStateFlow

function getCompStateFlow($compid)
{
    $key = getKey(array($compid));
    if (array_key_exists($key, $_SESSION['compstateflow'])) {
        return $_SESSION['compstateflow'][$key];
    }
    # get id for repeat state, useful because several of the calling functions
    #   need this information
    $query = "SELECT id FROM computerloadstate WHERE loadstatename = 'repeat'";
    $qh = doQuery($query, 101);
    if (!($row = mysql_fetch_assoc($qh))) {
        return array();
    }
    $loadstates['repeatid'] = $row['id'];
    $query = "SELECT `type` FROM computer WHERE id = {$compid}";
    $qh = doQuery($query, 101);
    if (!($row = mysql_fetch_assoc($qh))) {
        return array();
    }
    $type = $row['type'];
    $query = "SELECT cf.computerloadstateid AS stateid, " . "cs1.prettyname AS state, " . "cs1.loadstatename AS statename, " . "cf.nextstateid, " . "cs2.prettyname AS nextstate, " . "cs1.est AS statetime " . "FROM computerloadstate cs1, " . "computerloadflow cf " . "LEFT JOIN computerloadstate cs2 ON (cf.nextstateid = cs2.id) " . "WHERE cf.computerloadstateid = cs1.id AND " . "cf.type = '{$type}' ";
    $query2 = $query . "AND cf.computerloadstateid NOT IN " . "(SELECT nextstateid FROM computerloadflow WHERE `type` = '{$type}' " . "AND nextstateid IS NOT NULL)";
    $qh = doQuery($query2, 101);
    if (!($row = mysql_fetch_assoc($qh))) {
        return array();
    }
    $loadstates['data'][$row['stateid']] = $row;
    $loadstates['stateids'] = array($row['stateid']);
    $loadstates['nextstates'] = array($row['stateid'] => $row['nextstateid']);
    $loadstates['totaltime'] = 0;
    for ($i = 0; $i < 100; $i++) {
        # don't want an endless loop
        $query2 = $query . "AND cf.computerloadstateid = {$row['nextstateid']} " . "AND `type` = '{$type}'";
        $qh = doQuery($query2, 101);
        if (!($row = mysql_fetch_assoc($qh))) {
            $_SESSION['compstateflow'][$key] = $loadstates;
            return $loadstates;
        } else {
            array_push($loadstates['stateids'], $row['stateid']);
            $loadstates['nextstates'][$row['stateid']] = $row['nextstateid'];
            $loadstates['totaltime'] += $row['statetime'];
            $loadstates['data'][$row['stateid']] = $row;
        }
        if (empty($row['nextstateid'])) {
            $_SESSION['compstateflow'][$key] = $loadstates;
            return $loadstates;
        }
    }
    $_SESSION['compstateflow'][$key] = $loadstates;
    return $loadstates;
}
开发者ID:gw-acadtech,项目名称:VCL,代码行数:51,代码来源:utils.php


示例5: getConnectMethods

function getConnectMethods($imageid)
{
    $key = getKey(array('getConnectMethods', $imageid));
    if (array_key_exists($key, $_SESSION['usersessiondata'])) {
        return $_SESSION['usersessiondata'][$key];
    }
    $query = "SELECT DISTINCT c.id, " . "c.description, " . "cm.autoprovisioned " . "FROM connectmethod c, " . "connectmethodmap cm, " . "image i " . "LEFT JOIN OS o ON (o.id = i.OSid) " . "LEFT JOIN OStype ot ON (ot.name = o.type) " . "WHERE i.id = {$imageid} AND " . "cm.connectmethodid = c.id AND " . "cm.autoprovisioned IS NOT NULL AND " . "(cm.OStypeid = ot.id OR " . "cm.OSid = o.id) " . "ORDER BY c.description";
    $methods = array();
    $qh = doQuery($query, 101);
    while ($row = mysql_fetch_assoc($qh)) {
        $methods[$row['id']] = $row;
    }
    $_SESSION['usersessiondata'][$key] = $methods;
    return $methods;
}
开发者ID:bq-xiao,项目名称:apache-vcl,代码行数:15,代码来源:utils.php


示例6: AJsaveResource


//.........这里部分代码省略.........
         }
         # imagelibkey
         if ($data['imagelibkey'] != $olddata['imagelibkey']) {
             $updates[] = "imagelibkey = '{$data['imagelibkey']}'";
         }
         # keys
         if ($data['keys'] != $olddata['keys']) {
             $updates[] = "`keys` = '{$data['keys']}'";
         }
         # sshport
         if ($data['sshport'] != $olddata['sshport']) {
             $updates[] = "sshport = '{$data['sshport']}'";
         }
         # publicIPconfiguration
         if ($data['publicIPconfig'] != $olddata['publicIPconfig']) {
             $updates[] = "publicIPconfiguration = '{$data['publicIPconfig']}'";
         }
         # publicSubnetMask
         if ($data['publicnetmask'] != $olddata['publicnetmask']) {
             $updates[] = "publicSubnetMask = '{$data['publicnetmask']}'";
         }
         # publicDefaultGateway
         if ($data['publicgateway'] != $olddata['publicgateway']) {
             $updates[] = "publicDefaultGateway = '{$data['publicgateway']}'";
         }
         # publicDNSserver
         if ($data['publicdnsserver'] != $olddata['publicdnsserver']) {
             $updates[] = "publicDNSserver = '{$data['publicdnsserver']}'";
         }
         # sysadminEmailAddress
         if ($data['sysadminemail'] != $olddata['sysadminemail']) {
             $updates[] = "sysadminEmailAddress = '{$esc['sysadminemail']}'";
         }
         # sharedMailBox
         if ($data['sharedmailbox'] != $olddata['sharedmailbox']) {
             $updates[] = "sharedMailBox = '{$esc['sharedmailbox']}'";
         }
         # availablenetworks
         if ($data['availablenetworks'] != implode(',', $olddata['availablenetworks'])) {
             $updates[] = "availablenetworks = '{$data['availablenetworks']}'";
         }
         # federatedauth
         if ($data['federatedauth'] != $olddata['federatedauth']) {
             $updates[] = "NOT_STANDALONE = '{$data['federatedauth']}'";
         }
         if (count($updates)) {
             $query = "UPDATE managementnode SET " . implode(', ', $updates) . " WHERE id = {$data['rscid']}";
             doQuery($query);
         }
         # time servers
         if ($data['timeservers'] != $olddata['timeservers']) {
             $globalval = getVariable('timesource|global');
             if ($data['timeservers'] == '' || $data['timeservers'] == $globalval) {
                 deleteVariable("timesource|{$data['name']}");
             } else {
                 setVariable("timesource|{$data['name']}", $data['timeservers'], 'none');
             }
         }
         # NAT host
         if ($data['nathostenabled'] != $olddata['nathostenabled']) {
             if ($data['nathostenabled']) {
                 $query = "INSERT INTO nathost " . "(resourceid, " . "publicIPaddress, " . "internalIPaddress) " . "VALUES " . "({$olddata['resourceid']}, " . "'{$data['natpublicIPaddress']}', " . "'{$data['natinternalIPaddress']}') " . "ON DUPLICATE KEY UPDATE " . "publicIPaddress = '{$data['natpublicIPaddress']}', " . "internalIPaddress = '{$data['natinternalIPaddress']}'";
                 doQuery($query);
             } else {
                 $query = "DELETE FROM nathost " . "WHERE resourceid = {$olddata['resourceid']}";
                 doQuery($query);
             }
         } elseif ($data['nathostenabled'] && ($olddata['natpublicIPaddress'] != $data['natpublicIPaddress'] || $olddata['natinternalIPaddress'] != $data['natinternalIPaddress'])) {
             $query = "UPDATE nathost " . "SET publicIPaddress = '{$data['natpublicIPaddress']}', " . "internalIPaddress = '{$data['natinternalIPaddress']}' " . "WHERE resourceid = {$olddata['resourceid']}";
             doQuery($query);
         }
     }
     # clear user resource cache for this type
     $key = getKey(array(array($this->restype . "Admin", 'mgmtnodeAdmin'), array("administer"), 0, 1, 0, 0));
     unset($_SESSION['userresources'][$key]);
     $key = getKey(array(array($this->restype . "Admin", 'mgmtnodeAdmin'), array("administer"), 0, 0, 0, 0));
     unset($_SESSION['userresources'][$key]);
     $key = getKey(array(array($this->restype . "Admin", 'mgmtnodeAdmin'), array("manageGroup"), 0, 1, 0, 0));
     unset($_SESSION['userresources'][$key]);
     $key = getKey(array(array($this->restype . "Admin", 'mgmtnodeAdmin'), array("manageGroup"), 0, 0, 0, 0));
     unset($_SESSION['userresources'][$key]);
     $tmp = $this->getData(array('includedeleted' => 1, 'rscid' => $data['rscid'], 'alive' => 'neither'));
     $data = $tmp[$data['rscid']];
     $arr = array('status' => 'success');
     $arr['data'] = $data;
     if ($add) {
         $arr['action'] = 'add';
         $arr['data']['name'] = $arr['data']['hostname'];
         $arr['nogroups'] = 0;
         $groups = getUserResources(array($this->restype . 'Admin'), array('manageGroup'), 1);
         if (count($groups[$this->restype])) {
             $arr['groupingHTML'] = $this->groupByResourceHTML();
         } else {
             $arr['nogroups'] = 1;
         }
     } else {
         $arr['action'] = 'edit';
     }
     sendJSON($arr);
 }
开发者ID:bq-xiao,项目名称:apache-vcl,代码行数:101,代码来源:managementnode.php


示例7: getKey

<?php

include "getKey.php";
$key = getKey();
$file = "https://global.api.pvp.net/api/lol/static-data/na/v1.2/champion?champData=all&api_key=" . $key;
// header('Content-Type: application/json');
echo file_get_contents($file);
开发者ID:helenung,项目名称:On9amer,代码行数:7,代码来源:champIdName.php


示例8: AudioStreamConfig

$audioStreamConfig = new AudioStreamConfig();
$audioStreamConfig->bitrate = 128000;
$audioStreamConfig->samplerate = 44100;
$encodingProfileConfig->audioStreamConfigs[] = $audioStreamConfig;
/* CREATE ENCODING PROFILE */
$encodingProfile = EncodingProfile::create($encodingProfileConfig);
$jobConfig = new JobConfig();
$jobConfig->speed = \bitcodin\JobSpeedTypes::STANDARD;
$jobConfig->encodingProfile = $encodingProfile;
$jobConfig->input = $input;
$jobConfig->manifestTypes[] = ManifestTypes::M3U8;
/* CREATE JOB */
$job = Job::create($jobConfig);
/* WAIT UNTIL JOB IS FINISHED */
do {
    $job->update();
    sleep(1);
} while ($job->status != Job::STATUS_FINISHED && $job->status != Job::STATUS_ERROR);
$outputConfig = new FtpOutputConfig();
$outputConfig->name = "TestS3Output";
$outputConfig->host = str_replace('ftp://', '', getKey('ftpServer'));
$outputConfig->username = getKey('ftpUser');
$outputConfig->password = getKey('ftpPassword');
$output = Output::create($outputConfig);
/* TRANSFER JOB OUTPUT */
$job->transfer($output);
/* HELPER FUNCTION */
function getKey($key)
{
    return json_decode(file_get_contents(__DIR__ . '/test/config.json'))->{$key};
}
开发者ID:bitmovin,项目名称:bitcodin-php,代码行数:31,代码来源:createChangedFrameSampleRateJob.php


示例9: checkUserHasPriv

function checkUserHasPriv($priv, $uid, $node, $privs = 0, $cascadePrivs = 0)
{
    global $user;
    $key = getKey(array($priv, $uid, $node, $privs, $cascadePrivs));
    if (array_key_exists($key, $_SESSION['userhaspriv'])) {
        return $_SESSION['userhaspriv'][$key];
    }
    if ($user["id"] != $uid) {
        $_user = getUserInfo($uid);
    } else {
        $_user = $user;
    }
    $affilUserid = "{$_user['unityid']}@{$_user['affiliation']}";
    if (!is_array($privs)) {
        $privs = getNodePrivileges($node, 'users');
        $privs = getNodePrivileges($node, 'usergroups', $privs);
    }
    if (!is_array($cascadePrivs)) {
        $cascadePrivs = getNodeCascadePrivileges($node, 'users');
        $cascadePrivs = getNodeCascadePrivileges($node, 'usergroups', $cascadePrivs);
    }
    // if user (has $priv at this node) ||
    # (has cascaded $priv && ! have block at this node) return 1
    if (array_key_exists($affilUserid, $privs["users"]) && in_array($priv, $privs["users"][$affilUserid]) || array_key_exists($affilUserid, $cascadePrivs["users"]) && in_array($priv, $cascadePrivs["users"][$affilUserid]) && (!array_key_exists($affilUserid, $privs["users"]) || !in_array("block", $privs["users"][$affilUserid]))) {
        $_SESSION['userhaspriv'][$key] = 1;
        return 1;
    }
    foreach ($_user["groups"] as $groupname) {
        // if group (has $priv at this node) ||
        # (has cascaded $priv && ! have block at this node) return 1
        if (array_key_exists($groupname, $privs["usergroups"]) && in_array($priv, $privs["usergroups"][$groupname]['privs']) || array_key_exists($groupname, $cascadePrivs["usergroups"]) && in_array($priv, $cascadePrivs["usergroups"][$groupname]['privs']) && (!array_key_exists($groupname, $privs["usergroups"]) || !in_array("block", $privs["usergroups"][$groupname]['privs']))) {
            $_SESSION['userhaspriv'][$key] = 1;
            return 1;
        }
    }
    $_SESSION['userhaspriv'][$key] = 0;
    return 0;
}
开发者ID:gw-acadtech,项目名称:VCL,代码行数:38,代码来源:privileges.php


示例10: getKey

<?php

function getKey()
{
    if ($handle = opendir('./scripts/resources/')) {
        while (false !== ($entry = readdir($handle))) {
            if ($entry != "." && $entry != "..") {
                $path = "./scripts/resources/" . $entry;
            }
        }
        closedir($handle);
    }
    return $key = file_get_contents($path);
}
$url = "https://data.opentechinstitute.org/api/3/action/";
$auth_key = getKey();
$resource_id = "78377408-b750-4db9-bffb-dec9ef9c9477";
开发者ID:opentechinstitute,项目名称:transparency-reporting-toolkit,代码行数:17,代码来源:auth.php


示例11: getKey

/**
 * [getKey 根据value得到数组key]
 * @param  [type] $arr   [数组]
 * @param  [type] $value [值]
 * @return [type]        [description]
 */
function getKey($arr, $value)
{
    if (!is_array($arr)) {
        return null;
    }
    foreach ($arr as $k => $v) {
        $return = getKey($v, $value);
        if ($v == $value) {
            return $k;
        }
        if (!is_null($return)) {
            return $return;
        }
    }
}
开发者ID:js-wei,项目名称:Wechat,代码行数:21,代码来源:function.php


示例12: array

<?php

require_once "_key.php";
return array('debug' => true, 'url' => 'https://neshto.shantavo.com', 'timezone' => 'EST', 'locale' => 'bg', 'fallback_locale' => 'en', 'key' => getKey(), 'cipher' => MCRYPT_RIJNDAEL_128, 'providers' => array('Illuminate\\Foundation\\Providers\\ArtisanServiceProvider', 'Illuminate\\Auth\\AuthServiceProvider', 'Illuminate\\Cache\\CacheServiceProvider', 'Illuminate\\Session\\CommandsServiceProvider', 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider', 'Illuminate\\Routing\\ControllerServiceProvider', 'Illuminate\\Cookie\\CookieServiceProvider', 'Illuminate\\Database\\DatabaseServiceProvider', 'Illuminate\\Encryption\\EncryptionServiceProvider', 'Illuminate\\Filesystem\\FilesystemServiceProvider', 'Illuminate\\Hashing\\HashServiceProvider', 'Illuminate\\Html\\HtmlServiceProvider', 'Illuminate\\Log\\LogServiceProvider', 'Illuminate\\Mail\\MailServiceProvider', 'Illuminate\\Database\\MigrationServiceProvider', 'Illuminate\\Pagination\\PaginationServiceProvider', 'Illuminate\\Queue\\QueueServiceProvider', 'Illuminate\\Redis\\RedisServiceProvider', 'Illuminate\\Remote\\RemoteServiceProvider', 'Illuminate\\Auth\\Reminders\\ReminderServiceProvider', 'Illuminate\\Database\\SeedServiceProvider', 'Illuminate\\Session\\SessionServiceProvider', 'Illuminate\\Translation\\TranslationServiceProvider', 'Illuminate\\Validation\\ValidationServiceProvider', 'Illuminate\\View\\ViewServiceProvider', 'Illuminate\\Workbench\\WorkbenchServiceProvider', 'Roumen\\Feed\\FeedServiceProvider', 'Roumen\\Sitemap\\SitemapServiceProvider', 'Roumen\\Disqus\\DisqusServiceProvider', 'Roumen\\Asset\\AssetServiceProvider', 'Greggilbert\\Recaptcha\\RecaptchaServiceProvider', 'Mews\\Purifier\\PurifierServiceProvider'), 'manifest' => storage_path() . '/meta', 'aliases' => array('App' => 'Illuminate\\Support\\Facades\\App', 'Artisan' => 'Illuminate\\Support\\Facades\\Artisan', 'Auth' => 'Illuminate\\Support\\Facades\\Auth', 'Blade' => 'Illuminate\\Support\\Facades\\Blade', 'Cache' => 'Illuminate\\Support\\Facades\\Cache', 'ClassLoader' => 'Illuminate\\Support\\ClassLoader', 'Config' => 'Illuminate\\Support\\Facades\\Config', 'Controller' => 'Illuminate\\Routing\\Controller', 'Cookie' => 'Illuminate\\Support\\Facades\\Cookie', 'Crypt' => 'Illuminate\\Support\\Facades\\Crypt', 'DB' => 'Illuminate\\Support\\Facades\\DB', 'Eloquent' => 'Illuminate\\Database\\Eloquent\\Model', 'Event' => 'Illuminate\\Support\\Facades\\Event', 'File' => 'Illuminate\\Support\\Facades\\File', 'Form' => 'Illuminate\\Support\\Facades\\Form', 'Hash' => 'Illuminate\\Support\\Facades\\Hash', 'HTML' => 'Illuminate\\Support\\Facades\\HTML', 'Input' => 'Illuminate\\Support\\Facades\\Input', 'Lang' => 'Illuminate\\Support\\Facades\\Lang', 'Log' => 'Illuminate\\Support\\Facades\\Log', 'Mail' => 'Illuminate\\Support\\Facades\\Mail', 'Paginator' => 'Illuminate\\Support\\Facades\\Paginator', 'Password' => 'Illuminate\\Support\\Facades\\Password', 'Queue' => 'Illuminate\\Support\\Facades\\Queue', 'Redirect' => 'Illuminate\\Support\\Facades\\Redirect', 'Redis' => 'Illuminate\\Support\\Facades\\Redis', 'Request' => 'Illuminate\\Support\\Facades\\Request', 'Response' => 'Illuminate\\Support\\Facades\\Response', 'Route' => 'Illuminate\\Support\\Facades\\Route', 'Schema' => 'Illuminate\\Support\\Facades\\Schema', 'Seeder' => 'Illuminate\\Database\\Seeder', 'Session' => 'Illuminate\\Support\\Facades\\Session', 'SoftDeletingTrait' => 'Illuminate\\Database\\Eloquent\\SoftDeletingTrait', 'SSH' => 'Illuminate\\Support\\Facades\\SSH', 'Str' => 'Illuminate\\Support\\Str', 'URL' => 'Illuminate\\Support\\Facades\\URL', 'Validator' => 'Illuminate\\Support\\Facades\\Validator', 'View' => 'Illuminate\\Support\\Facades\\View', 'Asset' => 'Roumen\\Asset\\Asset', 'Feed' => 'Roumen\\Feed\\Facades\\Feed', 'Purifier' => 'Mews\\Purifier\\Facades\\Purifier'));
开发者ID:straho99,项目名称:NeshtoShantavo,代码行数:4,代码来源:app.php


示例13: getKey

<?php

$input = "iwrupvqb";
echo getKey($input);
function getKey($input)
{
    $count = 346386;
    while (true) {
        $hash = str_split(md5($input . $count), 6);
        if ($hash[0] === "000000") {
            return $count;
        }
        $count++;
    }
}
开发者ID:bmjohansen,项目名称:adventofcode,代码行数:15,代码来源:problem4.php


示例14: getServerProfileGroups

function getServerProfileGroups($userid, $type)
{
    global $user;
    $key = getKey(array('getServerProfileAdminGroups', $userid, $type));
    if (array_key_exists($key, $_SESSION['usersessiondata'])) {
        return $_SESSION['usersessiondata'][$key];
    }
    $resources = getUserResources(array('serverCheckOut', 'serverProfileAdmin'), array('available', 'administer'));
    $ids = array_keys($resources['serverprofile']);
    $inids = implode(',', $ids);
    if (empty($inids)) {
        $_SESSION['usersessiondata'][$key] = array();
        return array();
    }
    if ($type == 'admin') {
        $field = 'admingroupid';
    } else {
        $field = 'logingroupid';
    }
    if ($user['showallgroups']) {
        $query = "SELECT DISTINCT(u.id), " . "CONCAT(u.name, '@', a.name) AS name " . "FROM serverprofile s, " . "usergroup u, " . "affiliation a " . "WHERE s.{$field} = u.id AND " . "u.affiliationid = a.id AND " . "s.id IN ({$inids}) " . "ORDER BY name";
    } else {
        $query = "SELECT DISTINCT(u.id), " . "u.name " . "FROM serverprofile s, " . "usergroup u " . "WHERE s.{$field} = u.id AND " . "s.id IN ({$inids}) " . "ORDER BY name";
    }
    $qh = doQuery($query, 101);
    $groups = array();
    while ($row = mysql_fetch_assoc($qh)) {
        $groups[$row['id']] = $row['name'];
    }
    $_SESSION['usersessiondata'][$key] = $groups;
    return $groups;
}
开发者ID:bq-xiao,项目名称:apache-vcl,代码行数:32,代码来源:serverprofiles.php


示例15: AJremImageConnectMethod

 function AJremImageConnectMethod()
 {
     $imageid = getContinuationVar('imageid');
     $methods = getContinuationVar('methods');
     $revids = getContinuationVar('revids');
     $curmethods = getImageConnectMethods($imageid);
     $remidlist = mysql_real_escape_string(processInputVar('ids', ARG_STRING));
     $remids = explode(',', $remidlist);
     $revid = processInputVar('revid', ARG_NUMERIC);
     $newimage = getContinuationVar('newimage');
     foreach ($remids as $id) {
         if (!is_numeric($id)) {
             $arr = array('error' => 'invalidinput', 'msg' => i("Non-numeric data was submitted for a connection method id."));
             sendJSON($arr);
             return;
         }
     }
     if ($revid != 0 && !in_array($revid, $revids)) {
         $arr = array('error' => 'invalidrevision', 'msg' => i("Invalid revision id submitted."));
         sendJSON($arr);
         return;
     }
     if (!$newimage) {
         if ($revid == 0) {
             $revid = getProductionRevisionid($imageid);
         }
         # delete any current entries for method and image
         $query = "DELETE FROM connectmethodmap " . "WHERE imagerevisionid = {$revid} AND " . "connectmethodid IN ({$remidlist}) AND " . "autoprovisioned IS NULL";
         doQuery($query, 101);
         # query to see if enabled for OStype or OS
         $insvals = array();
         foreach ($remids as $id) {
             $query = "SELECT cm.connectmethodid " . "FROM connectmethodmap cm, " . "image i " . "LEFT JOIN OS o ON (o.id = i.OSid) " . "LEFT JOIN OStype ot ON (ot.name = o.type) " . "WHERE i.id = {$imageid} AND " . "cm.autoprovisioned IS NULL AND " . "cm.connectmethodid = {$id} AND " . "cm.disabled = 0 AND " . "(cm.OStypeid = ot.id OR " . "cm.OSid = o.id)";
             $qh = doQuery($query, 101);
             if (mysql_num_rows($qh)) {
                 # if so, add disabled entry for image revision and method
                 $insvals[] = "({$id}, {$revid}, 1)";
             }
         }
         if (count($insvals)) {
             $allinsvals = implode(',', $insvals);
             $query = "INSERT INTO connectmethodmap " . "(connectmethodid, " . "imagerevisionid, " . "disabled) " . "VALUES {$allinsvals}";
             doQuery($query, 101);
         }
     }
     $cdata = $this->basecdata;
     $cdata['imageid'] = $imageid;
     $cdata['methods'] = $methods;
     $cdata['revids'] = $revids;
     $cdata['newimage'] = $newimage;
     $addcont = addContinuationsEntry('AJaddImageConnectMethod', $cdata, 3600, 1, 0);
     $remcont = addContinuationsEntry('AJremImageConnectMethod', $cdata, 3600, 1, 0);
     $arr = array('addcont' => $addcont, 'remcont' => $remcont);
     sendJSON($arr);
     $key = getKey(array('getImageConnectMethods', (int) $imageid, (int) $revid));
     if (array_key_exists($key, $_SESSION['usersessiondata'])) {
         unset($_SESSION['usersessiondata'][$key]);
     }
     $key = getKey(array('getImageConnectMethods', (int) $imageid, 0));
     if (array_key_exists($key, $_SESSION['usersessiondata'])) {
         unset($_SESSION['usersessiondata'][$key]);
     }
 }
开发者ID:bq-xiao,项目名称:apache-vcl,代码行数:63,代码来源:image.php


示例16: mysqli

$db_server = 'nwt-2.l001.51vhost.net';
//'qdm163951542.my3w.com';
$db_account = 'db03152';
//'qdm163951542';
$db_password = '51Bc1B1B';
//'Woshizhu3312';
$db_name = 'db03152';
//'qdm163951542_db';
$conn = new mysqli($db_server, $db_account, $db_password, $db_name, '3306');
if ($conn->connect_error) {
    die('数据库连接失败!' . $conn->connection_error);
    return;
}
//插入信息
$userKey = getKey();
function insertUserInfo($conn, $userKey)
{
    $sql = 'insert into game_redbag_data(ip, start_time, userKey) values("' . getIP() . '","' . date('y-m-d H:i:s') . '", "' . $userKey . '")';
    $conn->query($sql);
}
insertUserInfo($conn, $userKey);
//生成随机码
function getKey()
{
    return uniqid('user', true);
}
//获取ip
function getIP()
{
    $ip = '未知ip';
开发者ID:EricLee1992,项目名称:gitSpace,代码行数:30,代码来源:server.php


示例17: CaptchaConfig

    STATE<br />
    ZIP<br />
    PHONE<br />
    EMAIL_ADDRESS<br />
    WHERE_DID_YOU_HEAR_FROM_US<br />
    PREFERRED_METHOD_TO_CONTACT<br />
    BEST_TIME_TO_CONTACT<br />
    COMMENT_QUESTION<br />
    <?php 
// define variables and set to empty values
$nameErr = $emailErr = $genderErr = $websiteErr = "";
$name = $email = $gender = $comment = $website = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if ($_POST["g-recaptcha-response"]) {
        $captchaconfig = new CaptchaConfig();
        $reCaptcha = new ReCaptcha($captchaconfig . getKey());
        $response = $reCaptcha->verifyResponse($_SERVER["REMOTE_ADDR"], $_POST["g-recaptcha-response"]);
    }
    if (empty($_POST["name"])) {
        $nameErr = "Name is required";
    } else {
        $name = test_input($_POST["name"]);
        // check if name only contains letters and whitespace
        if (!preg_match("/^[a-zA-Z ]*\$/", $name)) {
            $nameErr = "Only letters and white space allowed";
        }
    }
    if (empty($_POST["email"])) {
        $emailErr = "Email is required";
    } else {
        $email = test_input($_POST["email"]);
开发者ID:estilo,项目名称:CSVParsing,代码行数:31,代码来源:Registration.php


示例18: restore_migrate_urls

/**
 * This should mirror database replacements in cloner.php
 */
function restore_migrate_urls()
{
    // ----- DATABASE REPLACEMENTS
    /**
     * Finds all urls that begin with $oldSiteUrl AND
     * end either with OPTIONAL slash OR with MANDATORY slash following any number of any characters
     */
    //     Get all options that contain old urls, then check if we can replace them safely
    // Now check for old urls without WWW
    global $restoreParams, $wpdb;
    $oldSiteUrl = $restoreParams['oldSiteUrl'];
    $oldUrl = $restoreParams['oldUrl'];
    $tablePrefix = $restoreParams['tablePrefix'];
    $newUrl = $restoreParams['newUrl'];
    if (!isset($oldSiteUrl) || !isset($oldUrl)) {
        return false;
    }
    $parsedOldSiteUrl = parse_url(strpos($oldSiteUrl, '://') === false ? "http://{$oldSiteUrl}" : $oldSiteUrl);
    $parsedOldUrl = parse_url(strpos($oldUrl, '://') === false ? "http://{$oldUrl}" : $oldUrl);
    $host = getKey('host', $parsedOldSiteUrl, '');
    $path = getKey('path', $parsedOldSiteUrl, '');
    $oldSiteUrlNoWww = preg_replace('#^www\\.(.+\\.)#i', '$1', $host) . $path;
    $parsedOldSiteUrlNoWww = parse_url(strpos($oldSiteUrlNoWww, '://') === false ? "http://{$oldSiteUrlNoWww}" : $oldSiteUrlNoWww);
    if (isset($parse['scheme'])) {
        $oldSiteUrlNoWww = "{$parse['scheme']}://{$oldSiteUrlNoWww}";
    }
    // Modify the database for two variants of url, one with and one without WWW
    $oldUrls = array('oldSiteUrl' => $oldSiteUrl);
    $tmp1 = @"{$parsedOldUrl['host']}/{$parsedOldUrl['path']}";
    $tmp2 = @"{$parsedOldSiteUrlNoWww['host']}/{$parsedOldSiteUrlNoWww['path']}";
    if ($oldSiteUrlNoWww != $oldSiteUrl && $tmp1 != $tmp2) {
        $oldUrls['oldSiteUrlNoWww'] = $oldSiteUrlNoWww;
    }
    if (strpos($oldSiteUrl, $oldUrl) !== false && $oldSiteUrl != $oldUrl && $parsedOldUrl['host'] != $parsedOldSiteUrl['host']) {
        $oldUrls['oldUrl'] = $oldUrl;
    }
    foreach ($oldUrls as $key => $url) {
        if (empty($url) || strlen($url) <= 1) {
            continue;
        }
        if ($key == 'oldSiteUrlNoWww') {
            $amazingRegex = "~http://{$url}(?=(((/.*)+)|(/?\$)))~";
        } else {
            $amazingRegex = "~{$url}(?=(((/.*)+)|(/?\$)))~";
        }
        // Check options
        $query = "SELECT option_id, option_value FROM {$tablePrefix}options WHERE option_value LIKE '%{$url}%';";
        $selection = $wpdb->get_results($query, ARRAY_A);
        foreach ($selection as $row) {
            // Set a default value untouched
            $replaced = $row['option_value'];
            if (is_serialized($row['option_value'])) {
                $unserialized = unserialize($row['option_value']);
                if (is_array($unserialized)) {
                    array_walk_recursive($unserialized, 'recursiveUrlReplacement', array('newUrl' => $newUrl, 'regex' => $amazingRegex));
                    $replaced = serialize($unserialized);
                }
            } else {
                $replaced = preg_replace($amazingRegex, $newUrl, $replaced);
            }
            $escapedReplacement = $wpdb->_escape($replaced);
            $optId = $row['option_id'];
            if ($row['option_value'] != $replaced) {
                $query = "UPDATE {$tablePrefix}options SET option_value = '{$escapedReplacement}' WHERE option_id = {$optId}";
                $wpdb->query($query);
            }
        }
        // Check post meta
        $query = "SELECT meta_id, meta_value FROM {$tablePrefix}postmeta WHERE meta_value LIKE '%{$url}%'";
        $selection = $wpdb->get_results($query, ARRAY_A);
        foreach ($selection as $row) {
            $replacement = $row['meta_value'];
            if (is_serialized($replacement)) {
                $unserialized = unserialize($replacement);
                if (is_array($unserialized)) {
                    array_walk_recursive($unserialized, 'recursiveUrlReplacement', array('newUrl' => $newUrl, 'regex' => $amazingRegex));
                }
                $replacement = serialize($unserialized);
            } else {
                $replacement = preg_replace($amazingRegex, $newUrl, $replacement);
            }
            if ($replacement != $row['meta_value']) {
                $escapedReplacement = $wpdb->_escape($replacement);
                $id = $row['meta_id'];
                $query = "UPDATE {$tablePrefix}postmeta SET meta_value = '{$escapedReplacement}' WHERE meta_id = '{$id}'";
                $wpdb->query($query);
            }
        }
        // Do the same with posts
        $query = "SELECT ID, post_content, guid FROM {$tablePrefix}posts WHERE post_content LIKE '%{$url}%' OR guid LIKE '%{$url}%'";
        $selection = $wpdb->get_results($query, ARRAY_A);
        foreach ($selection as &$row) {
            $postContent = preg_replace($amazingRegex, $newUrl, $row['post_content']);
            $guid = preg_replace($amazingRegex, $newUrl, $row['guid']);
            if ($postContent != $row['post_content'] || $guid != $row['guid']) {
                $postContent = $wpdb->_escape($postContent);
                $guid = $wpdb->_escape($guid);
//.........这里部分代码省略.........
开发者ID:jimrucinski,项目名称:Vine,代码行数:101,代码来源:Backup.php


示例19: AJsubmitCompScheduleChange

 function AJsubmitCompScheduleChange()
 {
     $schid = getContinuationVar('schid');
     $schname = getContinuationVar('schname');
     $compids = getContinuationVar('compids');
     $complist = getContinuationVar('complist');
     $allids = implode(',', $compids);
     $query = "UPDATE computer " . "SET scheduleid = {$schid} " . "WHERE id in ({$allids})";
     doQuery($query);
     $msg = "The schedule for the following computer(s) was set to ";
     $msg .= "{$schname}:<br>{$complist}\n";
     # clear user resource cache for this type
     $key = getKey(array(array($this->restype . "Admin"), array("administer"), 0, 1, 0, 0));
     unset($_SESSION['userresources'][$key]);
     $key = getKey(array(array($this->restype . "Admin"), array("administer"), 0, 0, 0, 0));
     unset($_SESSION['userresources'][$key]);
     $ret = array('status' => 'success', 'title' => "Change Schedule", 'clearselection' => 1, 'refreshcount' => 1, 'msg' => $msg);
     sendJSON($ret);
 }
开发者ID:bq-xiao,项目名称:apache-vcl,代码行数:19,代码来源:computer.php


示例20: _type

 /**
  * [_type 获取信息类型]
  * @param  [type] $_type [数字代码]
  * @return [type]        [description]
  */
 private function _type($_type)
 {
     $type = array('未知' => 0, '环岛' => 1, '无属性道路' => 2, '主路' => 3, '高速连接路' => 4, '交叉点内路段' => 5, '连接道路' => 6, '停车场内部道路' => 7, '服务区内部道路' => 8, '桥' => 9, '步行街' => 10, '辅路' => 11, '匝道' => 12, '全封闭道路' => 13, '未定义交通区域' => 14, 'POI连接路' => 15, '隧道' => 16, '步行道' => 17, '公交专用道' => 18, '提前右转道' => 19, '桥' => 100, '收费站' => 101, '服务区,停车场' => 102, '加油站' => 103, '百货商城' => 104, '电器商场' => 105, '大厦' => 106, '五星级酒店' => 107, '超市' => 108, '快餐' => 109, '广场' => 110, '会议中心,展览中心' => 111, '学校(大专院校)' => 112, '村屯、风景名胜' => 113, '限速摄像头' => 200, '交通信号灯摄像头' => 201, '路况监控摄像头' => 202, '雷达测速摄像头' =& 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getKeyIgnoreCase函数代码示例发布时间:2022-05-15
下一篇:
PHP getJson函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap