Ejemplo n.º 1
0
    geoConvert($postData['zipCode']);
    // echo json_encode('Thank you' . $fullName . 'for your order!');
}
if (!empty($_POST['action'])) {
    switch ($_POST['action']) {
        case 'makes':
            findCarMakes();
            break;
        case 'models':
            findCarModels($_POST['make']);
            break;
        case 'engines':
            findCarEngines($_POST['model']);
            break;
        case 'submitInfo':
            uploadData($_POST);
            break;
        default:
            break;
    }
}
function findCarMakes()
{
    global $db;
    $query = 'SELECT * FROM car_makes';
    $result = mysqli_query($db, $query);
    $makes = mysqli_fetch_all($result);
    echo json_encode($makes);
}
function findCarModels($make)
{
Ejemplo n.º 2
0
	<?php 
class Database extends SQLite3
{
    function __construct()
    {
        $this->open('accountdata.db', SQLITE3_OPEN_READWRITE);
    }
}
if (array_key_exists("firstname", $_REQUEST)) {
    $firstname = $_REQUEST["firstname"];
    $lastname = $_REQUEST["lastname"];
    $username = $_REQUEST["username"];
    $password = $_REQUEST["password"];
    $email = $_REQUEST["email"];
    if ($password == $_REQUEST["confirmpass"]) {
        $data = uploadData($firstname . " " . $lastname, $username, md5($password), $email);
    } else {
        echo "Passwords do not match";
    }
}
function uploadData($name, $username, $password, $email)
{
    $db = new Database();
    $db->exec("CREATE TABLE IF NOT EXISTS recipes (username TEXT PRIMARY KEY, password TEXT, email TEXT, name TEXT)");
    $stmt = $db->prepare("INSERT INTO recipes VALUES (:us, :ps, :em, :n)");
    $stmt->bindValue(':us', $username);
    $stmt->bindValue(':ps', $password);
    $stmt->bindValue(':em', $email);
    $stmt->bindValue(':n', $name);
    $stmt->execute();
}
Ejemplo n.º 3
0
}
$Config = getConfig();
/* authenticate*/
if (!empty($Config->password) && !empty($Config->username) && (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) || ($Config->username != $_SERVER['PHP_AUTH_USER'] || $Config->password != md5($_SERVER['PHP_AUTH_PW'])))) {
    header('WWW-Authenticate: Basic realm="Trilby Setup"');
    header('HTTP/1.0 401 Unauthorized');
    echo 'You need to log in to access the setup page. If you have forgotton your password, delete "config.json" from your Trilby installation folder.';
    exit;
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if (empty($_POST)) {
        serveErrorPage('The file is too big for this server; try increasing the maximum post size and file upload settigns in php.ini, or at the command line, in your trilby directory, run: php bin/add-data.php {filename}');
    }
    try {
        savePostToConfig();
        uploadData();
    } catch (SetupException $e) {
        serveErrorPage($e->getMessage());
    }
    redirect('_setup');
} else {
    $maxfileSize = return_bytes(ini_get('upload_max_filesize'));
    $Store = new \Raffles\RafflesStore(RAFFLES_DATA_DIR);
    $ns = $Store->getNamespaces();
    $Config = getConfig(false);
    if (empty($Config->prefixes)) {
        $Config->prefixes = new StdClass();
    }
    foreach ($ns as $nsUri => $prefix) {
        if (empty($Config->prefixes->{$prefix})) {
            $Config->prefixes->{$prefix} = $nsUri;