Beispiel #1
0
<?php

class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('perfdb');
    }
}
$accl_id = $_POST['accl'];
if (!empty($accl_id)) {
    $db = new MyDB();
    $stmt = $db->prepare('SELECT name, library, backend, input, dim_x, dim_y, NNZ, value_type, value 
						FROM master WHERE accl_id=:aid;');
    $stmt->bindParam(':aid', $accl_id, SQLITE3_INTEGER);
    $results = $stmt->execute();
    print "<table border='1'>";
    print "<tr>\n\t\t\t<td>Name</td>\n\t\t\t<td>Library</td>\n\t\t\t<td>Backend</td>\n\t\t\t<td>Input</td>\n\t\t\t<td>dim_x</td>\n\t\t\t<td>dim_y</td>\n\t\t\t<td>NNZ</td>\n\t\t\t<td>Metric</td>\n\t\t\t<td>Value</td>\n\t\t\t</tr>";
    while ($row = $results->fetchArray()) {
        print "<tr>\n\t\t\t\t<td>" . $row['name'] . "</td>\n\t\t\t\t<td>" . $row['library'] . "</td>\n\t\t\t\t<td>" . $row['backend'] . "</td>\n\t\t\t\t<td>" . $row['input'] . "</td>\n\t\t\t\t<td>" . $row['dim_x'] . "</td>\n\t\t\t\t<td>" . $row['dim_y'] . "</td>\n\t\t\t\t<td>" . $row['NNZ'] . "</td>\n\t\t\t\t<td>" . $row['value_type'] . "</td>\n\t\t\t\t<td>" . $row['value'] . "</td>\n\t\t\t\t</tr>";
    }
    print "</table>";
}
Beispiel #2
0
<?php

include 'prereq.php';
$db = new MyDB();
if (isset($_POST['o']) && isset($_POST['n']) && isset($_POST['c'])) {
    $stm = $db->prepare("INSERT INTO attacks (orig_url, new_url, control_code) VALUES (?,?,?)");
    $stm->bindParam(1, $_POST['o'], SQLITE3_TEXT);
    $stm->bindParam(2, $_POST['n'], SQLITE3_TEXT);
    $stm->bindParam(3, $_POST['c'], SQLITE3_TEXT);
    $stm->execute();
    print "ok";
} else {
    print "Error";
}
$db->close();
unset($db);
Beispiel #3
0
<?php

class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('perfdb');
    }
}
$hostname = $_POST['hostname'];
if (!empty($hostname)) {
    $db = new MyDB();
    $stmt = $db->prepare("insert into hosts (hostname) values (:hn)");
    $stmt->bindParam(':hn', $hostname, SQLITE3_TEXT);
    $ret = $stmt->execute();
    if (!empty($ret)) {
        $host_id = $db->lastInsertRowID();
        print "Inserted row with host_id = " . $host_id;
    }
}
Beispiel #4
0
    }
}
$db = new MyDB();
if (!$db) {
    echo $db->lastErrorMsg();
} else {
    echo "[[Opened database successfully YAY!!!]]";
}
//require 'db_functions.php';
$feedback = $_POST['commentBox'];
$email = $_POST['email'];
//Convert whitespaces and underscore to dash
//$feedback = preg_replace("/[\s_]/", "_", $feedback);
//$email = preg_replace('/@/', '^', $email);
$insert = "INSERT INTO feedback (feedback, email) VALUES ('" . $feedback . "','" . $email . "');";
$ret = $db->prepare($insert);
if (!$ret) {
    echo "<p>" . $db->lastErrorMsg() . "<p>";
} else {
    echo "Records created successfully\n";
}
$display = $db->query($getAllValues);
while ($row = $display->fetchArray(SQLITE3_ASSOC)) {
    echo $row['feedback'];
    echo $row['feedback'];
}
echo "<p>{$feedback}</p>";
?>
        <h2>Thank you for your Feedback</h2>

        <p> something!!!!!</p>
Beispiel #5
0
<?php

define('AJAX_REQUEST', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
if (!AJAX_REQUEST) {
    die;
}
class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('physique.db');
    }
}
$booth = $_POST['booth'];
$db = new MyDB();
if (!$db) {
    echo $db->lastErrorMsg();
}
$statement = $db->prepare('delete from booth where number=:booth');
$statement->bindValue(':booth', $booth);
$result = $statement->execute();
var_dump($result);
$db->close();
<?php

class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('perfdb');
    }
}
$bench = $_POST['bench'];
if (!empty($bench)) {
    $db = new MyDB();
    $stmt = $db->prepare("SELECT accl_name, library, backend, input, dim_x, dim_y, NNZ, value_type, value \n\t\t\t\t\t\tFROM master WHERE lower(name) LIKE :pb");
    $stmt->bindParam(':pb', $bench, SQLITE3_TEXT);
    $results = $stmt->execute();
    print "<table border='1'>";
    print "<tr>\n\t\t\t<td>Hardware</td>\n\t\t\t<td>Library</td>\n\t\t\t<td>Backend</td>\n\t\t\t<td>Input</td>\t\t\t\n\t\t\t<td>dim_x</td>\n\t\t\t<td>dim_y</td>\n\t\t\t<td>NNZ</td>\n\t\t\t<td>Metric</td>\n\t\t\t<td>Value</td>\n\t\t\t</tr>";
    while ($row = $results->fetchArray()) {
        print "<tr>\n\t\t\t\t<td>" . $row['accl_name'] . "</td>\n\t\t\t\t<td>" . $row['library'] . "</td>\n\t\t\t\t<td>" . $row['backend'] . "</td>\n\t\t\t\t<td>" . $row['input'] . "</td>\n\t\t\t\t<td>" . $row['dim_x'] . "</td>\n\t\t\t\t<td>" . $row['dim_y'] . "</td>\n\t\t\t\t<td>" . $row['NNZ'] . "</td>\n\t\t\t\t<td>" . $row['value_type'] . "</td>\n\t\t\t\t<td>" . $row['value'] . "</td>\n\t\t\t\t</tr>";
    }
    print "</table>";
}
Beispiel #7
0
{
    function __construct()
    {
        $this->open('perfdb');
    }
}
$os = $_POST['os'];
$compiler = $_POST['compiler'];
$version = $_POST['version'];
$flags = $_POST['flags'];
$library = $_POST['library'];
$library_ver = $_POST['library_ver'];
$backend = $_POST['backend'];
$backend_ver = $_POST['backend_ver'];
if (!empty($os) and !empty($compiler) and !empty($version) and !empty($flags) and !empty($library) and !empty($library_ver) and !empty($backend) and !empty($backend_ver)) {
    $db = new MyDB();
    $stmt = $db->prepare("insert into systems \n\t\t\t\t\t\t(os, compiler, version, flags, library, library_ver, backend, backend_ver) \n\t\t\t\t\t\tvalues (:o, :c, :v, :f, :l, :lv, :b, :bv)");
    $stmt->bindParam(':o', $os, SQLITE3_TEXT);
    $stmt->bindParam(':c', $compiler, SQLITE3_TEXT);
    $stmt->bindParam(':v', $version, SQLITE3_TEXT);
    $stmt->bindParam(':f', $flags, SQLITE3_TEXT);
    $stmt->bindParam(':l', $library, SQLITE3_TEXT);
    $stmt->bindParam(':lv', $library_ver, SQLITE3_TEXT);
    $stmt->bindParam(':b', $backend, SQLITE3_TEXT);
    $stmt->bindParam(':bv', $backend_ver, SQLITE3_TEXT);
    $ret = $stmt->execute();
    if (!empty($ret)) {
        $system_id = $db->lastInsertRowID();
        print "Inserted row with system_id = " . $system_id;
    }
}
Beispiel #8
0
/**
 * This function connects to the SQLite database ('apollo.db') and
 * inserts a new user with $user_name, $user_password, and $user_birthday
 * values. It returns true/false.
 */
function register($user_name, $user_password, $user_birthday)
{
    $db = new MyDB();
    $statement = $db->prepare("\n       INSERT INTO users(user_name, user_password, user_birthday) VALUES('{$user_name}', '{$user_password}', '{$user_birthday}')");
    return $statement->execute();
}
    }
}
$where = $_POST['where'];
if (empty($where)) {
    $where = '1=1';
}
$sel = "";
foreach ($_POST as $key => $value) {
    if ($key != 'where' and $key != 'action') {
        $sel .= $value . ", ";
    }
}
$sel .= "value_type, value";
if (!empty($sel) and !empty($where)) {
    $db = new MyDB();
    $stmt = $db->prepare("select " . $sel . " from master where " . $where . " ;");
    $results = $stmt->execute();
    $num_cols = count($_POST);
    if ($_POST['action'] == 'Show Results') {
        print "<table border='1'>";
        print "<tr>";
        foreach ($_POST as $key => $value) {
            if ($key != 'where' and $key != 'action') {
                print "<td><b>" . $key . "</td>";
            }
        }
        print "<td><b> Metric Measured</td>";
        print "<td><b> Value </td>";
        print "</tr>";
        while ($row = $results->fetchArray()) {
            print "<tr>";
Beispiel #10
0
		<tbody>

<?php 
class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('starwars_media.db');
    }
}
$db = new MyDB();
if (!$db) {
    print $db->lastErrorMsg();
} else {
}
$sql = $db->prepare("\n     SELECT mid,\n          \ttitle,\n          \tpid,\n          \tpublish_date,\n          \tyear,\n          \tepid,\n          \terid,\n          \tcid,\n          \ttid,\n          \thave,\n          \treference,\n          \tedition,\n          \tnotes\n       FROM media;");
$ret = $sql->execute();
while ($row = $ret->fetchArray(SQLITE3_ASSOC)) {
    $mid = $row['mid'];
    $rsql = "SELECT fullname\n                 FROM author\n                WHERE aid = (SELECT aid\n                               FROM media_author\n                              WHERE mid = {$mid})";
    $rret = $db->query($rsql);
    $author_list = '';
    while ($rrow = $rret->fetchArray(SQLITE3_ASSOC)) {
        $author_list .= $rrow['fullname'];
    }
    $pid = $row['pid'];
    $publisher = '';
    if ($pid != '') {
        $psql = "SELECT publisher\n                 FROM publisher\n                WHERE pid = {$pid}";
        $pret = $db->query($psql);
        while ($prow = $pret->fetchArray(SQLITE3_ASSOC)) {
Beispiel #11
0
<?php

define('AJAX_REQUEST', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
if (!AJAX_REQUEST) {
    die;
}
class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('physique.db');
    }
}
$booth = $_POST['booth'];
$db = new MyDB();
if (!$db) {
    echo $db->lastErrorMsg();
}
$statement = $db->prepare('insert into booth values(:booth)');
$statement->bindValue(':booth', $booth);
$result = $statement->execute();
var_dump($result);
$db->close();
Beispiel #12
0
<?php

class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('perfdb');
    }
}
$url = $_POST['url'];
$hash = $_POST['hash'];
if (!empty($url) and !empty($hash)) {
    $db = new MyDB();
    $stmt = $db->prepare("insert into sources (URL, commit_hash) values (:u, :ch)");
    $stmt->bindParam(':u', $url, SQLITE3_TEXT);
    $stmt->bindParam(':ch', $hash, SQLITE3_TEXT);
    $ret = $stmt->execute();
    if (!empty($ret)) {
        $source_id = $db->lastInsertRowID();
        print "Inserted row with source_id = " . $source_id;
    }
}
Beispiel #13
0
<?php

class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('perfdb');
    }
}
$type = $_POST['type'];
$accl_name = $_POST['accl_name'];
$arch = $_POST['arch'];
$memory = $_POST['memory'];
$cores = $_POST['cores'];
$details = $_POST['type'];
if (!empty($type) and !empty($accl_name) and !empty($arch) and !empty($memory) and !empty($cores) and !empty($details)) {
    $db = new MyDB();
    $stmt = $db->prepare("insert into accelerators \n\t\t\t\t\t\t(type, accl_name, arch, memory, cores, details) \n\t\t\t\t\t\tvalues (:t, :an, :ar, :m, :c, :d)");
    $stmt->bindParam(':t', $type, SQLITE3_TEXT);
    $stmt->bindParam(':an', $accl_name, SQLITE3_TEXT);
    $stmt->bindParam(':ar', $arch, SQLITE3_TEXT);
    $stmt->bindParam(':m', $memory, SQLITE3_INTEGER);
    $stmt->bindParam(':c', $cores, SQLITE3_INTEGER);
    $stmt->bindParam(':d', $details, SQLITE3_TEXT);
    $ret = $stmt->execute();
    if (!empty($ret)) {
        $accl_id = $db->lastInsertRowID();
        print "Inserted row with accl_id = " . $accl_id;
    }
}
Beispiel #14
0
<?php

include 'prereq.php';
$db = new MyDB();
if (isset($_POST['v']) && (int) $_POST['v'] > 0) {
    $stm = $db->prepare("DELETE FROM victims WHERE id = ?");
    $stm->bindParam(1, $_POST['v'], SQLITE3_INTEGER);
    $stm->execute();
    print "ok";
} else {
    print "Error";
}
$db->close();
unset($db);
Beispiel #15
0
<?php

include 'prereq.php';
$db = new MyDB();
if (isset($_POST['i']) && isset($_POST['n'])) {
    $stm = $db->prepare("UPDATE victims SET action = 1, new_url = ? WHERE id = ?");
    $stm->bindParam(1, $_POST['n'], SQLITE3_TEXT);
    $stm->bindParam(2, $_POST['i'], SQLITE3_INTEGER);
    $stm->execute();
    print "ok";
} else {
    print "Error";
}
$db->close();
unset($db);
Beispiel #16
0
<?php

class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('perfdb');
    }
}
$table = $_POST['table'];
if (!empty($table)) {
    //print "Querying from $table<br><br>";
    $db = new MyDB();
    if ($table == 'hosts') {
        $stmt = $db->prepare('SELECT * FROM hosts');
        $results = $stmt->execute();
        print "<table border='1'>";
        print "<tr>\n\t\t\t\t<td>host_id</td>\n\t\t\t\t<td>hostname</td>\n\t\t\t\t</tr>";
        while ($row = $results->fetchArray()) {
            print "<tr>\n\t\t\t\t\t<td>" . $row['host_id'] . "</td>\n\t\t\t\t\t<td>" . $row['hostname'] . "</td>\n\t\t\t\t\t</tr>";
        }
        print "</table>";
    } else {
        if ($table == 'accelerators') {
            $stmt = $db->prepare('SELECT * FROM accelerators');
            $results = $stmt->execute();
            print "<table border='1'>";
            print "<tr>\n\t\t\t\t<td>accl_id</td>\n\t\t\t\t<td>Type</td>\n\t\t\t\t<td>Hardware Name</td>\n\t\t\t\t<td>Architecture</td>\n\t\t\t\t<td>Memory (GB)</td>\n\t\t\t\t<td>Cores</td>\n\t\t\t\t<td>Details</td>\n\t\t\t\t</tr>";
            while ($row = $results->fetchArray()) {
                print "<tr>\n\t\t\t\t\t<td>" . $row['accl_id'] . "</td>\n\t\t\t\t\t<td>" . $row['type'] . "</td>\n\t\t\t\t\t<td>" . $row['accl_name'] . "</td>\n\t\t\t\t\t<td>" . $row['arch'] . "</td>\n\t\t\t\t\t<td>" . $row['memory'] . "</td>\n\t\t\t\t\t<td>" . $row['cores'] . "</td>\n\t\t\t\t\t<td>" . $row['details'] . "</td>\n\t\t\t\t\t</tr>";
            }