Example #1
0
function main($conn, $cmd)
{
    if ($cmd == 'quit') {
        @setcookie(@siduMD5('SIDUCONN'), '', -1);
        @setcookie('SIDUSQL', '', -1);
    } elseif ($cmd == 'close') {
        $goto = @close_sidu_conn($_GET['id']);
        if ($goto) {
            return @header("Location: ./?id={$goto}");
        }
    } elseif ($cmd == @lang(1101)) {
        if (@substr($_FILES['fconn']['type'], 0, 4) == 'text' && $_FILES['fconn']['size'] && !$_FILES['fconn']['error']) {
            $err = @init_conn($conn, @file_get_contents($_FILES['fconn']['tmp_name']), $arrConn, $cmd);
        } else {
            $err = @lang(1102, 1);
        }
    } elseif ($cmd == @lang(1103) || $cmd == @lang(1104)) {
        $err = @test_conn($conn);
        if ($cmd == @lang(1104) && !$err) {
            return @main_conn($conn);
        } elseif (!$err) {
            $err = "OK";
        }
    }
    if ($cmd != "Open" && $conn['txt']) {
        $err .= @init_conn($conn, @dec65($conn['txt'], 1), $arrConn, $cmd);
    } elseif ((!$cmd || $cmd == 'quit' || $cmd == 'close') && !$conn['txt'] && $_COOKIE[@siduMD5('SIDUconnS')]) {
        $err .= @init_conn($conn, @dec65($_COOKIE[@siduMD5('SIDUconnS')], 1), $arrConn, @lang(1101));
    }
    @uppe();
    @main_form($conn, $arrConn, $err, $cmd);
    @down();
}
Example #2
0
<?php

// CONNECT TO MYSQL SERVER ------------------------------------------------------------------------
$servername = "SERVER";
$username = "******";
$password = "******";
$dbname = "AppTutDB";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Test connection
test_conn($conn);
// CONNECT to TWITTER -----------------------------------------------------------------------------
// Set access tokens here - see: https://dev.twitter.com/apps/
$settings = array('oauth_access_token' => "TOKEN", 'oauth_access_token_secret' => "SECRET", 'consumer_key' => "KEY", 'consumer_secret' => "SECRET");
$twitter = new TwitterAPIExchange($settings);
$requestMethod = 'GET';
Example #3
0
File: bht.php Project: qxh/bht
<?php

test_conn();
basic();
benchmark(300);
mul_get();
mul_set();
mul_del();
mul_benchmark(300, 16);
function test_conn()
{
    $short_conn = array();
    $long_conn = array();
    for ($i = 0; $i < 20; ++$i) {
        list($err, $handle) = bht_open("test");
        assert($err === false);
        assert($handle !== null);
        $short_conn[] = $handle;
    }
    for ($i = 0; $i < 40; ++$i) {
        list($err, $handle) = bht_popen("test");
        assert($err === false);
        assert($handle !== null);
        $long_conn[] = $handle;
    }
    foreach ($short_conn as $handle) {
        $err = bht_close($handle);
        assert($err === false);
    }
    foreach ($long_conn as $handle) {
        $err = bht_close($handle);