Example #1
0
$urid = loadvar('urid');
$db = new Database();
$communication = new Communication();
$returnValue = 'error';
if ($p == 'upload') {
    //upload data!
    $communication->storeUpload($_POST['query'], $urid);
    $communication->importTable($_POST['query']);
    $returnValue = 'ok';
} elseif ($p == 'updateavailable') {
    //is there an update available?
    $returnValue = 'no';
    if (sizeof($communication->getUserQueries($urid)) > 0) {
        $returnValue = 'yes';
    }
    if (sizeof($communication->getUserScripts($urid)) > 0) {
        $returnValue = 'yes';
    }
} elseif ($p == 'receive') {
    //receive the update
    $returnValue = '';
    if (sizeof($communication->getUserQueries($urid)) > 0) {
        //sql
        foreach ($communication->getUserQueries($urid) as $row) {
            if (trim($row['sqlcode']) != '') {
                $returnValue .= '1!~!~!' . $row['sqlcode'] . "!~!~!";
            }
        }
    }
    if (sizeof($communication->getUserScripts($urid)) > 0) {
        //scripts