Esempio n. 1
0
function main_conn($conn)
{
    global $SIDU;
    $cook = @explode('@', @dec65($_COOKIE[@siduMD5('SIDUCONN')], 1));
    foreach ($cook as $v) {
        $arr = @explode('#', $v, 2);
        if ($id < $arr[0]) {
            $id = $arr[0];
        }
    }
    $id++;
    //0id 1eng[my|pg] 2host 3user 4pass 5port 6dbs 7save 8charset
    $cook[$id] = "{$id}#{$conn['eng']}#{$conn['host']}#{$conn['user']}#" . @enc65($conn['pass'], 1) . "#{$conn['port']}#{$conn['dbs']}#{$conn['save']}#{$conn['char']}";
    @setcookie(@siduMD5('SIDUCONN'), @enc65(@implode('@', $cook), 1));
    $mood = @explode(".", $_COOKIE['SIDUMODE']);
    if ($conn['txt']) {
        //save conn in cookie
        $opt[0] = 1;
        $opara = @array('lang', 'gridMode', 'pgSize', 'tree', 'sortObj', 'sortData', 'menuTextSQL', 'menuText', 'his', 'hisErr', 'hisSQL', 'hisData', 'dataEasy', 'oid');
        $res = @init_conn_cut(@dec65($conn['txt'], 1), $opt, $opara);
        @setcookie(@siduMD5('SIDUconnS'), @enc65($res, 1));
        foreach ($opara as $i => $k) {
            $mood[$i] = isset($opt[$k]) ? $opt[$k] : "{$mood[$i]}";
        }
        $mood[0] = $conn['lang'];
        @setcookie('SIDUMODE', @implode(".", $mood), @time() + 311040000);
    } elseif ($mood[0] != $conn['lang']) {
        $mood[0] = $conn['lang'];
        @setcookie('SIDUMODE', @implode(".", $mood), @time() + 311040000);
    }
    @header("Location: ./?id={$id}");
}
Esempio n. 2
0
function db_conn($conn, $db)
{
    $pass = @dec65($conn[4], 1);
    if ($conn[1] == "my") {
        $res = @mysql_connect($conn[2] . ($conn[5] && $conn[5] != 3306 ? ":{$conn['5']}" : ""), $conn[3], $pass);
        //bug---charset still not work :(
        if ($conn[8] && $conn[8] != 'latin1') {
            @mysql_set_charset($conn[8]);
        }
        if ($db) {
            $res = @mysql_select_db($db);
        }
        return $res;
    } elseif ($conn[1] == "pg") {
        $pg = "host={$conn['2']} user={$conn['3']}";
        if ($pass) {
            $pg .= " password="******"', '\\"', $pass);
        }
        if ($conn[5] && $conn[5] != 5432) {
            $pg .= " port={$conn['5']}";
        }
        if ($db) {
            $pg .= " dbname={$db}";
        }
        return @pg_connect($pg);
    } elseif ($conn[1] == "sl") {
        if ($db) {
            return @sqlite_open($db, 0666);
        }
        $db = @explode(";", $conn[6], 2);
        return @sqlite_open($db[0], 0666);
    }
}