<?php
class MyDB extends SQLite3 {
function __construct($dbname) {
$this->open($dbname);
}
}
$db = new MyDB('../../Issues/issuesdb');
$where = $_POST['where'];
if (preg_match('/;|"|insert|drop|join|alter|delete|select|update|where/i', $where)) {
echo "<html><head><meta http-equiv=\"refresh\" content=\"0;URL='query.html'\" />";
exit;
}
$sql = "select * from Issues where Subject like '%$where%'";
echo "<br>$sql<br>";
$result = $db->query($sql);
if ($result) {
echo "<table border=\"2px\"><tr>";
$columns = $result->numColumns();
for($i = 0; $i < $columns; $i++) {
$fields[$i] = $result->columnName($i);
echo "<td><b><center>$fields[$i]<center><b></td>";
}
echo "</tr>";
while($row = $result->fetchArray(SQLITE3_ASSOC) ) {
$outval = "";
echo "<tr>";
foreach($fields as $field ) {
if ($field == "Link") {
$outval = $outval . "<td><a href=\"$row[$field]\" target=\"_blank\">$row[$field]</a></td>";
}else{
$outval = $outval . "<td>$row[$field]</td>";
}
}
echo $outval;
echo "</tr>";
}
echo "</table>";
}else{
echo "<b>No results!</b>";
}