git-svn-id: https://msi/svn/firstRepo/Service/branches/Manut_2.2.3@41 0f545695-f87b-41b6-9a03-7f16563b5454
This commit is contained in:
+29
-2
@@ -81,7 +81,7 @@ $app->get('/profile/:keyStore/ricette', function ($keyStore) use ($app) {
|
||||
$app->get('/profile/:keyStore', function ($keyStore) use ($app) {
|
||||
$callbackFn = $app->request()->get('callback');
|
||||
$mysqlconnetion = new MysqlClass;
|
||||
$query = "select ProfiloID, TipoAccesso, RisultatiRicerca, TemaUI, Name, Gender, 0 as NumRicette, BloccoNoteUpdated from profilo" .
|
||||
$query = "SELECT ProfiloID,TipoAccesso,RisultatiRicerca,TemaUI,Name,Gender,0 AS NumRicette,BloccoNoteUpdated,Email,bSpacciatore,bPrivacy,Cap,Comune,Provincia,TipoPM, Latitudine, Longitudine from profilo" .
|
||||
" where ProfiloID = '" . $keyStore . "'";
|
||||
$retObj = $mysqlconnetion->queryToObject($query);
|
||||
|
||||
@@ -100,11 +100,38 @@ $app->get('/profile/:keyStore', function ($keyStore) use ($app) {
|
||||
returnJson($app, $callbackFn, $retObj);
|
||||
});
|
||||
|
||||
$app->get('/profile/province(/:iniz)', function ($iniz = "") use ($app) {
|
||||
$callbackFn = $app->request()->get('callback');
|
||||
$mysqlconnetion = new MysqlClass;
|
||||
$where= "";
|
||||
if($iniz!="")
|
||||
$where = "WHERE Provincia like '" . $iniz . "%' ";
|
||||
$query = "select DISTINCT Provincia from comuni " . $where . "ORDER BY Provincia";
|
||||
$retObj = $mysqlconnetion->queryToObject($query);
|
||||
$mysqlconnetion->disconnetti();
|
||||
|
||||
returnJson($app, $callbackFn, $retObj);
|
||||
});
|
||||
|
||||
$app->get('/profile/comuni/:prov(/:iniz)', function ($prov ,$iniz = "") use ($app) {
|
||||
$callbackFn = $app->request()->get('callback');
|
||||
$mysqlconnetion = new MysqlClass;
|
||||
$where= "";
|
||||
if($iniz!="")
|
||||
$where = "AND Comune like '" . $iniz . "%' ";
|
||||
$query = "select Comune, CAP from comuni where Provincia = '" . $prov . "' " . $where . "ORDER BY Comune";
|
||||
$retObj = $mysqlconnetion->queryToObject($query);
|
||||
$mysqlconnetion->disconnetti();
|
||||
|
||||
returnJson($app, $callbackFn, $retObj);
|
||||
});
|
||||
|
||||
|
||||
$app->post('/profile', function () use ($app) {
|
||||
$callbackFn = $app->request()->get('callback');
|
||||
$json_data_body = json_decode($app->request()->post('dataPair'));
|
||||
$mysqlconnetion = new MysqlClass;
|
||||
$query = "insert into profilo(ProfiloID, Name, Email, Gender, TipoAccesso, RisultatiRicerca, TemaUI, UltimoAccesso, CreatoIl) values ('" . $json_data_body->keyStore . "', '" . str_replace("'", "''",$json_data_body->name) . "', '" . $json_data_body->email . "', '" . $json_data_body->gender . "', '" . $json_data_body->type . "', '" . $json_data_body->risRic . "', '" . $json_data_body->tema . "', NOW(), NOW())";
|
||||
$query = "insert into profilo(ProfiloID, Name, Email, Gender, TipoAccesso, RisultatiRicerca, TemaUI, UltimoAccesso, CreatoIl) values ('" . $json_data_body->keyStore . "', '" . str_replace("'", "''", htmlentities($json_data_body->name, null, "UTF-8")) . "', '" . $json_data_body->email . "', '" . $json_data_body->gender . "', '" . $json_data_body->type . "', '" . $json_data_body->risRic . "', '" . $json_data_body->tema . "', NOW(), NOW())";
|
||||
|
||||
$retNewID = $mysqlconnetion->insertRecord($query);
|
||||
$mysqlconnetion->disconnetti();
|
||||
|
||||
Reference in New Issue
Block a user