Exemplo n.º 1
0
<?php

header('Content-Type: application/json');
header('Cache-Control: no-cache, must-revalidate');
require_once 'dbinterface.php';
$unsafe_un = isset($_POST['u_n']) ? $_POST['u_n'] : false;
$result = ['valid' => "false"];
if ($unsafe_un) {
    $db_handle = new dbinterface\db_handle();
    $exists = 0;
    $record = $db_handle->pull("1 2 3", ['Username' => "{$unsafe_un}"], $exists);
    if (!empty($record)) {
        $result = ['valid' => "true", 'fname' => $record[0]['FirstName'], 'lname' => $record[0]['LastName']];
        $record = null;
        $db_handle = null;
    }
}
echo "exists: {$exists}";
echo json_encode($result);
Exemplo n.º 2
0
<?php

require_once './../dbinterface.php';
$dbh = new dbinterface\db_handle();
$dbh->set_target("users");
$dbh->push("1 2 3", "MyFirstName MyLastName username");
$udata = $dbh->pull("*");
print_r($udata);
$dbh = null;
Exemplo n.º 3
0
<?php

require_once './../dbinterface.php';
$dbh = new dbinterface\db_handle();
$dbh->set_target("store-cakes");
$record = $dbh->pull("1 2 3", "");
print_r($record);