Exemple #1
0
            //	    echo '<pre>';print_r($resp_data); die();
            if ($resp_data['status'] == 'success') {
                //{"status":"success","results":[{"money_id":43}]}
                $output['status'] = $resp_data['status'];
                $output['response'] = "Money item created";
                $output['money_id'] = $resp_data['results'][0]['money_id'];
            } else {
                $this->print_error(array("status" => "error", "response" => $results['response']));
            }
        } else {
            $this->print_error(array("status" => "error", "response" => $results['response']));
        }
        return $output;
    }
}
$ob = new api_handler();
$inp = $_REQUEST;
switch ($inp['action-type']) {
    case 'money-add-form':
        $output = $inp;
        //	$output['status']='success';
        //	$output['message']="Money item created";
        //	$output['money_id']=33009;
        $output = $ob->money_add_form($inp);
        break;
    default:
        $output = array();
        break;
}
echo json_encode($output);
die;
Exemple #2
0
        switch ($args[1]) {
            case 'live':
                $query = "SELECT * FROM `ListLive`";
                break;
            case 'about':
                $query = "SELECT * FORM `ListAbout` WHERE `lang_short` = '" . $args[2] . "'";
                break;
            case 'contact':
                $query = "SELECT * FORM `ListContact` WHERE `lang_short` = '" . $args[2] . "'";
                break;
        }
        $items = $this->{$dbh}->query("SELECT * FROM `List" . ucfirst($args[0]) . "` WHERE `public` =  1");
        while ($item = $items->fetch(PDO::FETCH_OBJ)) {
            array_push($results, $item);
        }
        if (!empty($results)) {
            $response['results'] = $results;
        } else {
            throw new Exception('No results get from database!');
        }
    }
}
if (!array_key_exists('HTTP_ORIGIN', $_SERVER)) {
    $_SERVER['HTTP_ORIGIN'] = $_SERVER['SERVER_NAME'];
}
try {
    $handler = new api_handler($_REQUEST['request']);
    echo $handler->processAPI();
} catch (Exception $e) {
    echo json_encode(array('error' => $e->getMessage()));
}
<?php

ob_start();
require_once "config.php";
$incomelicense = $_GET['license'];
$incomehash = $_GET['hash'];
$get_license = mysql_query("SELECT licenses.siteurl, licenses.siteurlwww, licenses.active, licenses.ver,licenses.brand,licenses.newstatus,licenses.newbrand FROM licenses WHERE licenses.licensekey = '{$incomelicense}' AND licenses.hash = '{$incomehash}'");
if (mysql_num_rows($get_license) > 0) {
    if ($license_data = mysql_fetch_array($get_license)) {
        /*
                $siteurl = $license_data['siteurl'];
                $siteurlwww = $license_data['siteurlwww'];
                $status = $license_data['active'];
                $ver = $license_data['ver'];
                $brand = $license_data['brand'];
                $newstatus = $license_data['newstatus'];
                $newbrand = $license_data['newbrand'];
                echo("$siteurl,$siteurlwww,$status,$ver,$brand,$newstatus,$newbrand");
        */
        api_handler::outSuccessData($license_data);
    }
} else {
    echo "notfound";
}
mysql_close($connection);
ob_flush();