Esempio n. 1
0
 public function run()
 {
     $sql = "select * from t_dolphin_user_profile where user_id = 1227713";
     $result = BDB::getConn()->read($sql, array());
     die;
     $this->app->response->setBody($result);
     $this->app->log->log('testlogname', $result);
 }
Esempio n. 2
0
<?php

define('WARAQ_ROOT', '../../..');
require_once WARAQ_ROOT . '/' . 'ini.php';
require_once "database.php";
$work_db = new BDB(array('type' => $_GET['dbt'], 'name' => $_GET['dbn'], 'host' => $_GET['dbh']), $_GET['dbu'], $_GET['dbp']);
$tables = $work_db->listTables();
echo "<ul>";
foreach ($tables as $table) {
    echo "<li><a onclick=\"input.editor.insertCode(' " . $table->name . ",', false); input.select()\">" . $table->name . "</a>";
    echo "<ul>";
    foreach ($table->loadColumns($work_db) as $column) {
        echo "<li><a onclick=\"input.editor.insertCode(' " . $column->name . ",', false); input.focus()\">" . $column->name . "</a>";
        echo "</li>";
    }
    echo "</ul>";
    echo "</li>";
}
echo "</ul>";
Esempio n. 3
0
 public function exec()
 {
     $query = $this->commonExecutionSteps();
     if ($this->query_type == "select") {
         //result
         $return_list = array();
         $meta = $query->result_metadata();
         while ($field = $meta->fetch_field()) {
             $return_list[] =& $row[$field->name];
         }
         $reflexive_query = new ReflectionClass("mysqli_stmt");
         $method = $reflexive_query->getMethod("bind_result");
         $method->invokeArgs($query, $return_list);
         $total_result = array();
         while ($line = $query->fetch()) {
             $total_result[] = BDB::valueArrayFromReference($return_list, $query->result_metadata());
         }
         if ($this->mysqli->error) {
             throw new Exception("BananaDB - MySQL Error [" . $this->mysqli->error . "]");
         }
         $query->close();
         return $total_result;
     }
     if ($this->query_type == "insert" || $this->query_type == "update" || $this->query_type == "delete") {
         if ($this->mysqli->error) {
             throw new Exception("BananaDB - MySQL Error [" . $this->mysqli->error . "]");
         }
         $query->close();
         return true;
     }
 }
Esempio n. 4
0
    die("<div style='background-color: yellow; border: 2px solid red; padding: 10px; margin: 10px;'>{$error}</div>");
}
define('WARAQ_ROOT', '../..');
require_once WARAQ_ROOT . '/' . 'ini.php';
require_once "database.php";
$db_user = $_SERVER['PHP_AUTH_USER'];
$db_password = $_SERVER['PHP_AUTH_PW'];
$db_type = $_GET['dbt'] ? $_SESSION['db_type'] = $_GET['dbt'] : $_SESSION['db_type'];
$db_name = $_GET['dbn'] ? $_SESSION['db_name'] = $_GET['dbn'] : $_SESSION['db_name'];
$db_host = $_GET['dbh'] ? $_SESSION['db_host'] = $_GET['dbh'] : $_SESSION['db_host'];
if (!$db_type) {
    header('Location: ' . $bazdig->get('/db')->url);
    die;
}
try {
    $work_db = new BDB(array('type' => $db_type, 'name' => $db_name, 'host' => $db_host), $db_user, $db_password);
} catch (Exception $e) {
    Header("WWW-Authenticate: Basic realm=\"{$db_name}@{$db_host}\"");
    Header("HTTP/1.0 401 Unauthorized");
    $error = "<b>CONNECTION ERROR</b> check your server permissions then check that the PDO_SQLITE and PDO_MYSQL modules are installed <sub>(<a href='../db/'>select another database</a>)</sub>";
    die("<div style='background-color: yellow; border: 2px solid red; padding: 10px; margin: 10px;'>{$error}</div>");
}
$bazdig_db = $bazdig->getparam('db')->file;
if (!is_writable($bazdig_db)) {
    $error = "<b>WARNING</b> your history database is not writeable. <code>chmod 777 " . $bazdig->file . " && chmod 666 {$bazdig_db}</code></div>";
    echo "<div style='background-color: yellow; border: 2px solid red; padding: 10px; margin: 10px;'>{$error}</div>";
}
?>
<html>
<head>
<title><?php