2 if ( "5" > phpversion()) {
3 $error = "<b>ERROR</b> Bazdig works only with PHP5. sorry.";
4 die("<div style='background-color: yellow; border: 2px solid red; padding: 10px; margin: 10px;'>$error</div>");
8 define('WARAQ_ROOT', '../..');
9 require_once WARAQ_ROOT
.'/'. 'ini.php';
11 require_once "database.php";
13 if (!$_SESSION['db_type']) {
14 header('Location: '. $bazdig->get('/db')->url
);
17 $bazdig_db = $bazdig->getparam('db')->file
;
18 if (!is_writable($bazdig_db)) {
19 $error = "<b>WARNING</b> your history database is not writeable. <code>chmod 777 ". $bazdig->file
." && chmod 666 $bazdig_db</code></div>";
20 echo "<div style='background-color: yellow; border: 2px solid red; padding: 10px; margin: 10px;'>$error</div>";
24 $work_db = new BDB(array('type' => $_SESSION['db_type'], 'name' => $_SESSION['db_name'], 'host' => $_SESSION['db_host']), $_SESSION['db_user'], $_SESSION['db_password']);
25 } catch (Exception
$e) {
26 $error = "<b>ERROR</b> check that the PDO_SQLITE and PDO_MYSQL modules are installed";
27 die("<div style='background-color: yellow; border: 2px solid red; padding: 10px; margin: 10px;'>$error</div>");
34 <script src
="../codepress/codepress.js" type
="text/javascript"></script
>
35 <link rel
="stylesheet" type
="text/css" href
="../bazdig.css" />
39 <a href
="../history/" accesskey
="h" title
="(h)">history
</a
><a href
="../db/" accesskey
="d" title
="(d)">database
</a
>
42 <form method
="get" action
="../sql/exec/" target
="_new">
45 <textarea id
="input" name
="input" class="codepress sql linenumbers-off" style
="width:100%;height:350px;" wrap
="off" tabindex
="1">
46 <?php
echo stripslashes($_GET['q']); ?
>
48 <button id
="ok" accesskey
="k" title
="(k)" onclick
="q.value=input.getCode(); submit();">OK
</button
>
49 <input type
="hidden" name
="q" id
="q"/>
55 $dbName = $work_db->name
;
56 $dbLocation = $work_db->host
;
57 if ($work_db->type
== 'sqlite' ||
$work_db->type
== 'sqlite2') {
58 $dbLocation = dirname($dbName);
59 $dbName = basename($dbName);
61 echo "<h3>".$dbName."</h3>";
62 echo " @". $dbLocation;
63 echo $work_db->httpGet($bazdig->get('/db/schema/'));
65 $error = "<b>WARNING</b> you have not selected a database";
66 echo "<div style='background-color: yellow; border: 2px solid red; padding: 10px; margin: 10px;'>$error</div>";