예제 #1
0
function updateDB($db, $currencies, $dtTo)
{
    // массив кодов валют, которые будем запрашивать
    $toRecieve = array();
    // проверка, что есть по запросу уже в базе и запрос новых данных из источника
    foreach ($currencies as $currency) {
        if ($currency == 'RUB') {
            continue;
        }
        // по рублю не запрашиваем, т.к. это базовая валюта хранения
        $result = $db->query("SELECT MAX(`dt`) AS dtMax FROM `rates` WHERE `c` = '{$currency}' ");
        while ($array = $result->fetcharray(SQLITE3_ASSOC)) {
            if ($array['dtMax'] < $dtTo) {
                $toRecieve[] = $currency;
            }
        }
    }
    // есть что запрашивать?
    if (count($toRecieve)) {
        // запросим коды
        $codes = getCodes();
        // теперь запросим и положим в базу все валюты
        foreach ($toRecieve as $currency) {
            $rates = getData($dtTo, $codes[$currency]);
            // вносим в базу
            $queries = array();
            $queries[] = 'BEGIN';
            // ускорить вставку нескольких сотен записей
            foreach ($rates as $k => $v) {
                $queries[] = "INSERT OR IGNORE INTO `rates` (`dt`, `c`, `v`) VALUES ('{$k}', '{$currency}', '{$v}')";
            }
            $queries[] = 'COMMIT';
            $db->query(implode(";", $queries));
        }
    }
}
예제 #2
0
파일: ebpls006.php 프로젝트: laiello/ebpls
    global $cookieSetSec;
    echo "cookieSetHr Received==>" . $cookieSetHr . "<BR>";
    $cookieSetHr = intval($cookieSet);
    $cookieSetSec = $cookieSetHr * 60;
    return $cookieSetSec;
}
function convertSecToHrs($thIntCookieExp)
{
    global $cookieSetSec;
    global $cookieSetHr;
    //echo "cookieSetHr Received==>".$cookieSetHr."<BR>";
    $cookieSetSec = $thIntCookieExp;
    $cookieSetHr = $cookieSetSec / 60;
    return $cookieSetHr;
}
$arrCodes = getCodes();
//print_r($arrCodes);
$frmSubmitPref = isset($frmSubmitPref) ? $frmSubmitPref : '';
if ($frmSubmitPref == "Submit") {
    $priColor = "#6A6A6A";
    $secColor = "#6FCDF9";
    $shade1Color = "#FFFFFF";
    $shade2Color = "#FFFFFF";
    $cookieSet = convertHrsToSec($cookieSet);
    $arrKeys = array('thIntPassLen', 'thIntPassRetLimit', 'thIntCookieExp', 'thIntPageLimit');
    $arrValues = array($passLen, $passRetLimit, $cookieSet, $pageLimit);
    $strSetupDir = empty($ThUserData['domain']) ? "" : $ThUserData['domain'] . '/';
    updateConfig($arrKeys, $arrValues, "setup/" . $strSetupDir . "setting.php");
    //echo "<== REACHED THIS PLACE ==><BR>";
    //exit();
    $frmSubmitPref = "";
예제 #3
0
 * token_get_all took: 1.6169309616089 seconds.
 *
 * Yes, it's dead slow compared to C :/
 */
error_reporting(E_ALL | E_STRICT);
require __DIR__ . '/../lib/Phlexy/bootstrap.php';
require __DIR__ . '/phpLexerDefinition.php';
if ($argc !== 3) {
    showHelp('Invalid argument count.');
}
$testType = $argv[1];
$testFilesDirectory = $argv[2];
if ($testType === 'php-src-tests') {
    $codes = getCodes($testFilesDirectory, 'PhpTestFileFilterIterator', 'CodeFilterIterator');
} elseif ($testType === 'code') {
    $codes = getCodes($testFilesDirectory, 'PhpFileFilterIterator', 'CodeFilterIterator');
} else {
    showHelp('Invalid test type.');
}
$factory = new \Phlexy\LexerFactory\Stateful\UsingCompiledRegex(new \Phlexy\LexerDataGenerator());
$lexer = $factory->createLexer(getPHPLexerDefinition(), 'i');
$myTime = 0;
$phpTime = 0;
foreach ($codes as $code) {
    try {
        $startTime = microtime(true);
        $myLex = $lexer->lex($code);
        $myTime += microtime(true) - $startTime;
    } catch (Exception $e) {
        echo "\n", 'Exception: ', $codes->getPathName(), "\n";
        echo 'Message: ', $e->getMessage(), "\n";
예제 #4
0
            $err = true;
            $err_handy2 = true;
            $err_phone_text = $t_error_phone2;
        }
    }
    // Check Name
    if (!$name) {
        $err = true;
        $err_name = true;
        $err_name_text = $t_error_name;
    }
    if (!$err) {
        $display = 2;
        // Create and send code
        if ($_SESSION['codes'] != "{$email}{$handynr}{$name}") {
            $codes = getCodes($email, $handynr, $name);
            $_SESSION['codes'] = "{$email}{$handynr}{$name}";
        }
    }
}
if (isset($_GET['code']) || isset($_POST['code'])) {
    $code = $_POST['code'] ? $_POST['code'] : $_GET['code'];
    // Check Code
    if (!checkEmailCode($code)) {
        $err = TRUE;
        $display = 5;
    }
    if (!$err) {
        $display = 3;
        $first = $_GET['code'];
        if (!$first) {
예제 #5
0
function getDataFromOSFM($kpiid)
{
    // return '20';
    try {
        $results = null;
        $DB = new MxOptix();
        $query = "SELECT Count(job) qty FROM apps.xxbi_cyp_activity_log_v@osfm\n    WHERE ORGANIZATION_CODE = 'F07'AND item IN ({codes})\n    AND systemdate_est BETWEEN To_Date(To_Char(SYSDATE-2,'yyyymmdd')||'0730','yyyymmddhh24mi') AND\n    To_Date(To_Char(SYSDATE-1,'yyyymmdd')||'0730','yyyymmddhh24mi')AND OPERATION_TYPE = 'DONE'\n    ";
        $query = str_replace("{codes}", getCodes($kpiid), $query);
        $DB->setQuery($query);
        oci_execute($DB->statement);
        oci_fetch_all($DB->statement, $results, 0, -1, OCI_FETCHSTATEMENT_BY_ROW);
        $DB->close();
        return $results[0]['QTY'];
    } catch (Exception $e) {
        $DB->close();
        echo 'Caught exception: \\n' . print_r($e) . "\n";
    }
}