Пример #1
0
function createDB()
{
    $host = urldecode($_GET['host']);
    $name = $_GET['name'];
    $user = $_GET['user'];
    $pwd = $_GET['pwd'];
    $store = $_GET['store'];
    $ret = "<p>";
    $dbExists = false;
    $con = mysql_connect($host, $user, $pwd);
    // try to connect
    if (!$con) {
        die('Could not connect: ' . mysql_error());
    }
    $dblist = mysql_list_dbs($con);
    // check if the database already exists
    while ($row = mysql_fetch_object($dblist)) {
        $db = $row->Database;
        if ($db == $name) {
            $dbExists = true;
        }
    }
    if (!$dbExists) {
        if (mysql_query("CREATE DATABASE " . $name, $con)) {
            return createStore($host, $name, $user, $pwd, $store);
        } else {
            $ret .= "Error creating database: " . mysql_error() . "</p>";
        }
    } else {
        $ret .= "The database '{$name}' already exists. We are ready to create an RDF store.</p>";
    }
    mysql_close($con);
    return createStore($host, $name, $user, $pwd, $store);
}
Пример #2
0
<?php

include_once '../arc/ARC2.php';
$DEBUG = false;
if (isset($_GET['cmd'])) {
    $cmd = $_GET['cmd'];
    if ($cmd == "create-db") {
        echo createDB();
    } else {
        if ($cmd == "create-store") {
            createStore();
        } else {
            echo "<p>Sorry, I didn't understand the command ...</p>";
        }
    }
}
function createDB()
{
    global $DEBUG;
    $host = urldecode($_GET['host']);
    $name = $_GET['name'];
    $user = $_GET['user'];
    $pwd = $_GET['pwd'];
    $ret = "<p>";
    $dbExists = false;
    $con = mysql_connect($host, $user, $pwd);
    // try to connect
    if (!$con) {
        die('Could not connect: ' . mysql_error());
    }
    $dblist = mysql_list_dbs($con);
<?php

header('Content-type: application/json');
chdir('../../common');
require_once 'init.php';
chdir('../database');
require_once 'plataform.php';
chdir('../actions');
require_once 'plataform.php';
chdir('../ajax/plataform');
if (isset($_GET['name']) and isset($_GET['slogan']) and isset($_GET['vat']) and isset($_GET['domain'])) {
    if (checkNameDomainStore($_GET['name'], $_GET['domain']) == null) {
        $id = createStore($_GET['name'], $_GET['slogan'], $_GET['domain'], $_GET['vat'], null);
        addNoCategory($id);
        echo json_encode(array("result" => "ok"));
    } else {
        echo json_encode(array("result" => "name or domain in use"));
    }
} else {
    echo json_encode(array("result" => "missingParams"));
}