*/ $res = unserialize($sessie->getS('psa-results')); $sessie->unsetS('psa-results'); $html = new Page(); $html->setLanguage('nl_NL'); $html->build(); $head = new Head(); $head->setCharset('UTF-8'); $head->setTitle('PSA - query results'); $head->setCss('./css/psa.css'); $head->setJs('./js/PSA.js'); $head->build(); $body = new Body(); $body->build(); include_once './inc/menubar.php'; $body->line('Executed query : <br />'); $body->line('<p class="qs">' . $sessie->getS('psa-query-results') . '<hr />'); $sessie->unsetS('psa-query-results'); $titles = FALSE; if (!$res) { $body->line('no further feedback'); } else { $table = new Table(); $table->setClas('result'); $table->setId('listing'); $table->build(); $odd = TRUE; foreach ($res as $item) { if (!$titles) { $tr = new Th(); $names = array_keys(get_object_vars($item));
if($length < 10) { $size = 10; } */ $inp = new Input(); $inp->setName($colname); $inp->setValue($item); $inp->setSize(50); $inp->setMaxlength(128); /**/ $tr = new Tr(); $tr->add($colname); $tr->add($inp->dump()); $tr->build(); ++$i; /**/ } $tr = new Tr(); $tr->add(' '); $tr->add($submit->dump()); $tr->build(); unset($table); unset($form); $body->line('<hr />'); $backlink = new Link(); $backlink->setHref('controller.php?cmd=table_browse&table=' . $req->get('table')); $backlink->setName('Back to list'); $backlink->build(); include_once './inc/footer.php'; unset($body); unset($html);
$sql->qo($q); $res = $sql->fo(); // var_dump($res); $html = new Page(); $html->setLanguage('nl_NL'); $html->build(); $head = new Head(); $head->setCharset('UTF-8'); $head->setTitle('PSA - show table info for ' . $req->get('table')); $head->setCss('./css/psa.css'); $head->setJs('./js/PSA.js'); $head->build(); $body = new Body(); $body->build(); include_once './inc/menubar.php'; $body->line('<h3>Structure for table : <b>' . $req->get('table') . '</b></h3>'); $table = new Table(); $table->setClas('result'); $table->setId('listing'); $table->build(); $th = new Th(); $th->add('name'); $th->add('type'); $th->add('size'); $th->add('null allowed'); $th->add('default'); $th->add('remove'); $th->build(); $odd = TRUE; foreach ($res as $item) { $pos = strpos($item->type, '(');
$sql->qo($q); $res = $sql->fo(); // echo "BOTTOM WAARDE : <b><h1>".$sessie->getS('bottom')."</h1></b>"; $html = new Page(); $html->setLanguage('nl_NL'); $html->build(); $head = new Head(); $head->setCharset('UTF-8'); $head->setTitle('PSA - query results'); $head->setCss('./css/psa.css'); $head->setjs('./js/PSA.js'); $head->build(); $body = new Body(); $body->build(); include_once './inc/menubar.php'; $body->line('<h3>Table : ' . $req->get('table') . '</h3>'); $odd = FALSE; if (!$res) { $body->line('Table does not contain records'); } else { $resultset = ''; foreach ($res as $item) { $insert = 'INSERT INTO ' . $req->get('table') . ' ('; for ($i = 0; $i < sizeof($col); ++$i) { // var_dump($col); // echo "$col[$i] - waarde = ".$item->$col[$i].'<br />'; $insert .= $col[$i] . ', '; $vals[] = $item->{$col}[$i]; } $insert = substr($insert, 0, -2) . ") VALUES ('"; // var_dump($vals);
$sql->qo($q); $res = $sql->fo(); // unset($sql); $html = new Page(); $html->setLanguage('nl_NL'); $html->build(); $head = new Head(); $head->setCharset('UTF-8'); $head->setTitle('PSA - show tables'); $head->setCss('./css/psa.css'); $head->setjs('./js/PSA.js'); $head->build(); $body = new Body(); $body->build(); include_once './inc/menubar.php'; $body->line(); $link = new Link(); $link->setHref('controller.php?cmd=table_add'); $link->setClas('butter'); $link->setName('Add table'); $link->build(); $body->line('<hr>'); if (!$res) { $body->line('No tables defined.'); } else { $body->line('<h3>List tables</h3>'); $table = new Table(); $table->setClas('result'); $table->build(); foreach ($res as $item) { if ($item->name == 'sqlite_sequence') {
$inp_naam->setAutofocus(true); $inp_pass = new Input(); $inp_pass->setName('geheim'); $inp_pass->setType('password'); $inp_pass->setSize(20); $html = new Page(); $html->setLanguage('nl-nl'); $html->build(); $head = new Head(); $head->setTitle('PSA - login'); $head->setCss('./css/psa.css'); $head->setJs('./js/PSA.js'); $head->build(); $body = new Body(); $body->build(); $body->line('<h3>PHP SQLite Admin tool - log in</h3>'); $form = new Form(); $form->setAction('login.php'); $form->build(); $table = new Table(); $table->build(); $tr = new Tr(); $tr->add('Login'); $tr->add($inp_naam->dump()); $tr->build(); $tr = new Tr(); $tr->add('Pass'); $tr->add($inp_pass->dump()); $tr->build(); $tr = new Tr(); $tr->add(' ');
foreach ($res as $item) { $fields[] = $item->name; } $html = new Page(); $html->setLanguage('nl_NL'); $html->build(); $head = new Head(); $head->setCharset('UTF-8'); $head->setTitle('PSA - create index'); $head->setCss('./css/psa.css'); $head->setJs('./js/PSA.js'); $head->build(); $body = new Body(); $body->build(); include_once './inc/menubar.php'; $body->line("Index creation on table : <b>" . $req->get('table') . "</b><br>"); $form = new Form(); $form->setAction('controller.php'); $form->setJs(' onsubmit="return PSA.indexcol();" '); $form->build(); // TODO: check if table name already exists $name = new Input(); $name->setName('idxname'); $name->setSize(50); $name->setMaxlength(128); $name->setId('idxname'); $body->line('Name : ' . $name->dump() . ' ' . $cmd->dump() . '<br>'); for ($i = 0; $i < sizeof($fields); ++$i) { $select = new Select(); $select->setName('col' . $i); $select->setSize(1);
$sessie->unsetS('psa-db'); $cmd->setValue('base'); $submit->setValue('Go'); $html = new Page(); $html->setLanguage('nl_NL'); $html->build(); $head = new Head(); $head->setTitle('PSA - homepage'); $head->setCss('./css/psa.css'); $head->setJs('./js/PSA.js'); $head->build(); $body = new Body(); $body->build(); include_once './inc/menubar.php'; $body->line(' <p>Databases will be selected based on the preset directory and extension. Currently the following are stored : </p>'); include_once './forms/form_base.php'; $body->line('<hr /> <p>PSA stands for PHP - SQLite - Administration. This application lets you do the basic operations with SQLite3 databases. The current version only supports the very basics. Check <a href="controller.php?cmd=bts">[here]</a> for more information.</p> <p> The following issues are already implemented :</p> <ul> <li>select directory and extension</li> <li>list databases based on the above</li> <li>list tables based on selected database</li> <li>perform random queries on the selected database</li> <li>show table structure</li> <li>browse table</li>
$body->line(' <h3>PHP SQLite Admin tool - PSA in short...</h3> <p>PSA stands for PHP - SQLite - Administration. This application lets you do the basic operations with SQLite3 databases. The current version only supports the very basics. Check out the manual for more information.</p> <p>Click <a href="login.php">here</a> to log in.</p> <p> The following issues are already implemented :</p> <ul> <li>select directory and extension</li> <li>list databases based on the above</li> <li>list tables based on selected database</li> <li>perform random queries on the selected database</li> <li>show table structure</li> <li>browse table</li> <li>update rows</li> <li>delete rows</li> <li>create database</li> <li>drop database</li> <li>vacuum database</li> <li>create table</li> <li>drop column</li> <li>dump sql statements per table</li> <li>insert rows</li> <li>drop table</li> <li>list indexes (part of table info)</li> <li>drop indexes</li> <li>create indexes</li> <li>list views</li> <li>drop views</li> <li>dump table data to csv et al</li> <li>show all performed queries and also hold result</li> <li>dump database structure</li> </ul> <p>Not yet planned :</p> <ul> <li>stored procedures</li> <li>triggers</li> </ul>');
* [since] 2011.02.10 * [expl] documentation avant la lettre - Behind The Screens */ $html = new Page(); $html->setLanguage('nl_NL'); $html->build(); $head = new Head(); $head->setCharset('UTF-8'); $head->setTitle('PSA - connection'); $head->setCss('./css/psa.css'); $head->setJs('./js/PSA.js'); $head->build(); $body = new Body(); $body->build(); include_once './inc/menubar.php'; $body->line('<div class="xemel">'); $xml = simplexml_load_file('./inc/bts.xml'); // menu foreach ($xml->item->caption as $cap) { $link = new Link(); // $link->setHref('#'.$cap->name); $body->line('<a href="#' . $cap->name . '" >' . $cap->name . '</a><br />'); } $body->line('<hr />'); // content foreach ($xml->item->caption as $cap) { $body->line('<h3><a name="' . $cap->name . '">' . $cap->name . '</a></h3>'); foreach ($cap->para as $paraf) { $body->line('<p>' . $paraf . '</p>'); } $body->line('<a href="#top"><==</a><br /><br />');
// echo "BOTTOM WAARDE : <b><h1>".$sessie->getS('bottom')."</h1></b>"; $html = new Page(); $html->setLanguage('nl_NL'); $html->build(); $head = new Head(); $head->setCharset('UTF-8'); $head->setTitle('PSA - database schema'); $head->setCss('./css/psa.css', 'screen'); $head->setCss('./css/psaprint.css', 'print'); $head->setjs('./js/PSA.js'); $head->build(); $body = new Body(); $body->build(); include_once './inc/menubar.php'; if (!$res) { $body->line('no tables defined yet'); } else { foreach ($res as $item) { $body->line('<div class="schema"><h3>' . $item->name . '</h3>'); $q_fields = "PRAGMA table_info('" . $item->name . "')"; $sql->qo($q_fields); $res_fields = $sql->fo(); $table = new Table(); $table->setClas('result_schema'); $table->setId('listing'); $table->build(); $th = new Th(); $th->add('name'); $th->add('type'); $th->add('size'); $th->add('null allowed');
var_dump($res); */ // echo "BOTTOM WAARDE : <b><h1>".$sessie->getS('bottom')."</h1></b>"; $html = new Page(); $html->setLanguage('nl_NL'); $html->build(); $head = new Head(); $head->setCharset('UTF-8'); $head->setTitle('PSA - query results'); $head->setCss('./css/psa.css'); $head->setjs('./js/PSA.js'); $head->build(); $body = new Body(); $body->build(); include_once './inc/menubar.php'; $body->line('<h2>Table : ' . $req->get('table') . '</h2>'); if ($is_view) { $body->line('This is a view and individual data cannot be altered.<br />'); } if (!$is_view) { $link = new Link(); $link->setHref('controller.php?cmd=record_add&table=' . $req->get('table')); $link->setClas('butter'); $link->setName('Add record'); $body->line($link->dump()); } $body->line('<hr>'); $odd = FALSE; if (!$res) { $body->line('Table does not contain records'); } else {
$head = new Head(); $head->setCharset('UTF-8'); $head->setTitle('PSA - add table'); $head->setCss('./css/psa.css'); $head->setJs('./js/PSA.js'); $head->build(); $body = new Body(); $body->build(); include_once './inc/menubar.php'; // TODO: check if table name already exists $name = new Input(); $name->setName('tblname'); $name->setSize(50); $name->setMaxlength(128); $name->setId('tblname'); $body->line('<span class="vet">Table name</span><br /> '); $body->line($name->dump()); $create = new Link(); $create->setHref('controller.php?cmd=table_add_action'); $create->setName('<button>Create</button>'); $body->line($create->dump()); $body->line('<hr />'); $body->line('<span class="vet">Fields</span><br /> '); $table = new Table(); $table->setClas('result'); $table->build(); $th = new Th(); $th->add('name'); $th->add('type'); $th->add('primary'); $th->add('size');
} } $cmd->setValue('qs'); $submit->setValue('Go!'); $html = new Page(); $html->setLanguage('en_EN'); $html->build(); $head = new Head(); $head->setTitle('PSA - query'); $head->setCss('./css/psa.css'); $head->setJs('./js/PSA.js'); $head->build(); $body = new Body(); $body->build(); include_once './inc/menubar.php'; $body->line('Insert raw sql query : '); $form = new Form(); $form->setAction('controller.php'); $form->build(); $inp_text = new Textarea(); $inp_text->setRows(15); $inp_text->setCols(70); $inp_text->setName('qs'); $inp_text->setId('to_text'); $inp_text->build(); $body->line(); $cmd->build(); $submit->build(); unset($form); $body->line('<hr />'); $psa = new PDO("sqlite:./data/base.sqlite");
$submit->setClas('button'); $cmd->setValue('create_db'); $form = new Form(); $form->setAction('controller.php'); $form->build(); $table = new Table(); $table->build(); $tr = new Tr(); $tr->add('New database : '); $tr->add($inp_db->dump()); $tr->add($submit->dump()); $tr->add($cmd->dump()); $tr->build(); unset($table); unset($form); $body->line('<hr />'); $files = array(); if ($handle = opendir($sessie->getS('psa-dir'))) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { if (stristr($file, '.' . $sessie->getS('psa-ext'))) { $files[] = str_replace('.' . $sessie->getS('psa-ext'), '', $file); } } } closedir($handle); if ('0' !== sizeof($files)) { sort($files); } } $odd = TRUE;