[e0b6a5e] | 1 | <?php |
---|
| 2 | /** |
---|
| 3 | * @file remotepc.php |
---|
| 4 | * @brief OpenGnsys Server REST API consumed by UDS Server for Remote PC implementation. |
---|
| 5 | * @warning All input and output messages are formatted in JSON. |
---|
| 6 | * @note Some ideas are based on article "How to create REST API for Android app using PHP, Slim and MySQL" by Ravi Tamada, thanx. |
---|
| 7 | * @license GNU GPLv3+ |
---|
| 8 | * @author Ramón M. Gómez, ETSII Univ. Sevilla |
---|
| 9 | * @version 1.1.0 - First version |
---|
| 10 | * @date 2017-02-01 |
---|
| 11 | */ |
---|
| 12 | |
---|
| 13 | |
---|
| 14 | // REST routes. |
---|
| 15 | |
---|
| 16 | /** |
---|
[63e439a] | 17 | * @brief Reserve a client with an installed image and the older reservation time, then send a boot/reboot operation depending on its status. |
---|
[9ed6a67] | 18 | * @warning If "lab" parameter is specified, then choose a client from this lab. |
---|
[63e439a] | 19 | * @note Route: /ous/:ouid/images/:imageid/reserve, Method: POST |
---|
[9a39c75] | 20 | * @param integer ouid OU identificator |
---|
| 21 | * @param integer imageid image identificator |
---|
[63e439a] | 22 | * @note Input JSON message: {"labid":int_labid,"maxtime":int_hours} |
---|
[e0b6a5e] | 23 | */ |
---|
[d8b6c70] | 24 | $app->post('/ous/:ouid/images/:imageid/reserve(/)', 'validateApiKey', |
---|
[e0b6a5e] | 25 | function($ouid, $imageid) use ($app) { |
---|
| 26 | global $cmd; |
---|
| 27 | global $AMBITO_ORDENADORES; |
---|
| 28 | global $EJECUCION_COMANDO; |
---|
| 29 | global $ACCION_INICIADA; |
---|
[232d1da] | 30 | global $ACCION_FINALIZADA; |
---|
[e0b6a5e] | 31 | global $ACCION_SINRESULTADO; |
---|
[232d1da] | 32 | global $ACCION_FALLIDA; |
---|
[e0b6a5e] | 33 | global $userid; |
---|
[6f17d76] | 34 | $response = Array(); |
---|
| 35 | $ogagent = Array(); |
---|
[e0b6a5e] | 36 | |
---|
| 37 | // Checking parameters. |
---|
[d8b6c70] | 38 | try { |
---|
[2f11053] | 39 | if (!checkIds($ouid, $imageid)) { |
---|
[d8b6c70] | 40 | throw new Exception("Ids. must be positive integers"); |
---|
| 41 | } |
---|
| 42 | // Reading POST parameters in JSON format. |
---|
| 43 | $input = json_decode($app->request()->getBody()); |
---|
[2f11053] | 44 | // Default: no lab. filter. |
---|
| 45 | if (isset($input->labid)) { |
---|
| 46 | $labid = $input->labid != "0" ? $input->labid : '%'; |
---|
| 47 | } else { |
---|
| 48 | $labid = '%'; |
---|
| 49 | } |
---|
[d8b6c70] | 50 | $maxtime = isset($input->maxtime) ? $input->maxtime : 24; // Default: 24 h. |
---|
[2f11053] | 51 | $opts = Array('options' => Array('min_range' => 1)); // Check for int>0 |
---|
[d8b6c70] | 52 | if (!filter_var($labid, FILTER_VALIDATE_INT, $opts) and $labid !== '%') { |
---|
| 53 | throw new Exception("Lab id. must be positive integer"); |
---|
| 54 | } |
---|
| 55 | if (!filter_var($maxtime, FILTER_VALIDATE_INT, $opts)) { |
---|
| 56 | throw new Exception("Time must be positive integer (in hours)"); |
---|
| 57 | } |
---|
| 58 | } catch (Exception $e) { |
---|
| 59 | // Communication error. |
---|
| 60 | $response["message"] = $e->getMessage(); |
---|
| 61 | jsonResponse(400, $response); |
---|
| 62 | $app->stop(); |
---|
| 63 | } |
---|
[63e439a] | 64 | // Choose older not-reserved client with image installed and get ogAdmServer data. |
---|
[e0b6a5e] | 65 | $cmd->texto = <<<EOD |
---|
[e7d47882] | 66 | SELECT adm.idadministradorcentro, entornos.ipserveradm, entornos.portserveradm, |
---|
[d8b6c70] | 67 | ordenadores.idordenador, ordenadores.nombreordenador, ordenadores.ip, |
---|
| 68 | ordenadores.mac, ordenadores.agentkey, ordenadores_particiones.numdisk, |
---|
[2f11053] | 69 | ordenadores_particiones.numpar, aulas.idaula, aulas.idcentro |
---|
[e0b6a5e] | 70 | FROM entornos, ordenadores |
---|
| 71 | JOIN aulas USING(idaula) |
---|
[e7d47882] | 72 | RIGHT JOIN administradores_centros AS adm USING(idcentro) |
---|
[e0b6a5e] | 73 | RIGHT JOIN usuarios USING(idusuario) |
---|
| 74 | RIGHT JOIN ordenadores_particiones USING(idordenador) |
---|
| 75 | RIGHT JOIN imagenes USING(idimagen) |
---|
[6f17d76] | 76 | LEFT JOIN remotepc ON remotepc.id=ordenadores.idordenador |
---|
[e7d47882] | 77 | WHERE adm.idadministradorcentro = '$userid' |
---|
[9a39c75] | 78 | AND aulas.idcentro = '$ouid' AND aulas.idaula LIKE '$labid' AND aulas.inremotepc = 1 |
---|
| 79 | AND imagenes.idimagen = '$imageid' AND imagenes.inremotepc = 1 |
---|
[35a63b6] | 80 | AND (remotepc.reserved < NOW() OR ISNULL(reserved)) |
---|
[63e439a] | 81 | ORDER BY remotepc.reserved ASC LIMIT 1; |
---|
[e0b6a5e] | 82 | EOD; |
---|
| 83 | $rs=new Recordset; |
---|
| 84 | $rs->Comando=&$cmd; |
---|
| 85 | if (!$rs->Abrir()) return(false); // Error opening recordset. |
---|
[e7d47882] | 86 | // Check if user is admin and client exists. |
---|
[e0b6a5e] | 87 | $rs->Primero(); |
---|
[e7d47882] | 88 | if (checkAdmin($rs->campos["idadministradorcentro"]) and checkParameter($rs->campos["idordenador"])) { |
---|
[2f11053] | 89 | // Read query data. |
---|
| 90 | $serverip = $rs->campos["ipserveradm"]; |
---|
| 91 | $serverport = $rs->campos["portserveradm"]; |
---|
| 92 | $clntid = $rs->campos["idordenador"]; |
---|
| 93 | $clntname = $rs->campos["nombreordenador"]; |
---|
| 94 | $clntip = $rs->campos["ip"]; |
---|
| 95 | $clntmac = $rs->campos["mac"]; |
---|
| 96 | $agentkey = $rs->campos["agentkey"]; |
---|
| 97 | $disk = $rs->campos["numdisk"]; |
---|
| 98 | $part = $rs->campos["numpar"]; |
---|
| 99 | $labid = $rs->campos["idaula"]; |
---|
| 100 | $ouid = $rs->campos["idcentro"]; |
---|
| 101 | // Check client's status. |
---|
| 102 | $ogagent[$clntip]['url'] = "https://$clntip:8000/opengnsys/status"; |
---|
| 103 | $result = multiRequest($ogagent); |
---|
| 104 | if (empty($result[$clntip]['data'])) { |
---|
| 105 | // Client is off, send a boot command to ogAdmServer. |
---|
| 106 | // TODO: if client is busy????? |
---|
| 107 | $reqframe = "nfn=Arrancar\r". |
---|
| 108 | "ido=$clntid\r". |
---|
| 109 | "iph=$clntip\r". |
---|
| 110 | "mac=$clntmac\r". |
---|
| 111 | "mar=1\r"; |
---|
| 112 | sendCommand($serverip, $serverport, $reqframe, $values); |
---|
| 113 | } else { |
---|
| 114 | // Client is on, send a reboot command to its OGAgent. |
---|
| 115 | $ogagent[$clntip]['url'] = "https://$clntip:8000/opengnsys/reboot"; |
---|
| 116 | $ogagent[$clntip]['header'] = Array("Authorization: ".$agentkey); |
---|
[6f17d76] | 117 | $result = multiRequest($ogagent); |
---|
[2f11053] | 118 | // ... (check response) |
---|
| 119 | //if ($result[$clntip]['code'] != 200) { |
---|
| 120 | // ... |
---|
| 121 | } |
---|
| 122 | // DB Transaction: mark choosed client as reserved and |
---|
| 123 | // create an init session command into client's actions queue. |
---|
| 124 | $cmd->texto = "START TRANSACTION;"; |
---|
| 125 | $cmd->Ejecutar(); |
---|
| 126 | $timestamp = time(); |
---|
| 127 | $cmd->texto = <<<EOD |
---|
[e0b6a5e] | 128 | INSERT INTO remotepc |
---|
[d8b6c70] | 129 | SET id='$clntid', reserved=NOW() + INTERVAL $maxtime HOUR, urllogin=NULL, urllogout=NULL |
---|
[6f17d76] | 130 | ON DUPLICATE KEY UPDATE |
---|
[e0b6a5e] | 131 | id=VALUES(id), reserved=VALUES(reserved), |
---|
[6f17d76] | 132 | urllogin=VALUES(urllogin), urllogout=VALUES(urllogout); |
---|
| 133 | EOD; |
---|
[2f11053] | 134 | $t1 = $cmd->Ejecutar(); |
---|
| 135 | $cmd->texto = <<<EOD |
---|
[e0b6a5e] | 136 | INSERT INTO acciones |
---|
| 137 | SET tipoaccion=$EJECUCION_COMANDO, |
---|
| 138 | idtipoaccion=9, |
---|
| 139 | idcomando=9, |
---|
[6f17d76] | 140 | parametros='nfn=IniciarSesion\rdsk=$disk\rpar=$part', |
---|
[e0b6a5e] | 141 | descriaccion='RemotePC Session', |
---|
[6f17d76] | 142 | idordenador=$clntid, |
---|
| 143 | ip='$clntip', |
---|
| 144 | sesion=$timestamp, |
---|
[e0b6a5e] | 145 | fechahorareg=NOW(), |
---|
| 146 | estado=$ACCION_INICIADA, |
---|
| 147 | resultado=$ACCION_SINRESULTADO, |
---|
| 148 | ambito=$AMBITO_ORDENADORES, |
---|
[6f17d76] | 149 | idambito=$clntid, |
---|
| 150 | restrambito='$clntip', |
---|
[e0b6a5e] | 151 | idcentro=$ouid; |
---|
[9a39c75] | 152 | EOD; |
---|
[2f11053] | 153 | $t2 = $cmd->Ejecutar(); |
---|
[232d1da] | 154 | // Create event to remove reservation on timeout (15 min.). |
---|
[0c9d25a] | 155 | $timeout = "15 MINUTE"; |
---|
| 156 | $cmd->texto = <<<EOD |
---|
| 157 | CREATE EVENT e_timeout_$clntid |
---|
| 158 | ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL $timeout DO |
---|
| 159 | BEGIN |
---|
[232d1da] | 160 | SET @clntid = NULL; |
---|
[0c9d25a] | 161 | UPDATE acciones |
---|
| 162 | SET estado = $ACCION_FINALIZADA, resultado = $ACCION_FALLIDA, |
---|
| 163 | descrinotificacion = 'Timeout' |
---|
[232d1da] | 164 | WHERE descriaccion = 'RemotePC Session' AND estado = $ACCION_INICIADA |
---|
| 165 | AND idordenador = (SELECT @clntid := '$clntid'); |
---|
[0c9d25a] | 166 | IF @clntid IS NOT NULL THEN |
---|
| 167 | UPDATE remotepc |
---|
| 168 | SET reserved=NOW() - INTERVAL 1 SECOND, urllogin=NULL, urllogout=NULL |
---|
| 169 | WHERE id = @clntid; |
---|
[232d1da] | 170 | DELETE FROM acciones |
---|
| 171 | WHERE idordenador = @clntid |
---|
| 172 | AND descriaccion = 'RemotePC Session' |
---|
| 173 | AND descrinotificacion = 'Timeout'; |
---|
| 174 | END IF; |
---|
[0c9d25a] | 175 | END |
---|
| 176 | EOD; |
---|
| 177 | $t3 = $cmd->Ejecutar(); |
---|
[232d1da] | 178 | if ($t1 and $t2 and $t3) { |
---|
[2f11053] | 179 | // Commit transaction on success. |
---|
| 180 | $cmd->texto = "COMMIT;"; |
---|
| 181 | $cmd->Ejecutar(); |
---|
| 182 | // Send init session command if client is booted on ogLive. |
---|
| 183 | $reqframe = "nfn=IniciarSesion\r". |
---|
| 184 | "ido=$clntid\r". |
---|
| 185 | "iph=$clntip\r". |
---|
| 186 | "dsk=$disk\r". |
---|
| 187 | "par=$part\r"; |
---|
| 188 | sendCommand($serverip, $serverport, $reqframe, $values); |
---|
| 189 | // Compose JSON response. |
---|
| 190 | $response['id'] = $clntid; |
---|
| 191 | $response['name'] = $clntname; |
---|
| 192 | $response['ip'] = $clntip; |
---|
| 193 | $response['mac'] = $clntmac; |
---|
| 194 | $response['lab']['id'] = $labid; |
---|
| 195 | $response['ou']['id'] = $ouid; |
---|
| 196 | jsonResponse(200, $response); |
---|
[232d1da] | 197 | } else { |
---|
[2f11053] | 198 | // Roll-back transaction on DB error. |
---|
| 199 | $cmd->texto = "ROLLBACK;"; |
---|
| 200 | $cmd->Ejecutar(); |
---|
[9a39c75] | 201 | // Error message. |
---|
[2f11053] | 202 | $response["message"] = "Database error"; |
---|
[9a39c75] | 203 | jsonResponse(400, $response); |
---|
| 204 | $app->stop(); |
---|
| 205 | } |
---|
[9ed6a67] | 206 | } |
---|
[e0b6a5e] | 207 | $rs->Cerrar(); |
---|
| 208 | } |
---|
| 209 | ); |
---|
| 210 | |
---|
| 211 | |
---|
| 212 | /** |
---|
| 213 | * @brief Store UDS server URLs to resend some events recieved from OGAgent. |
---|
| 214 | * @note Route: /ous/:ouid/labs/:labid/clients/:clntid/events, Method: POST |
---|
| 215 | * @param string urlLogin URL to redirect login notification. |
---|
| 216 | * @param string urlLogout URL to redirect logout notification. |
---|
| 217 | * @warning Events parameters will be stored in a new "remotepc" table. |
---|
| 218 | */ |
---|
| 219 | $app->post('/ous/:ouid/labs/:labid/clients/:clntid/events', 'validateApiKey', |
---|
| 220 | function($ouid, $labid, $clntid) use ($app) { |
---|
| 221 | global $cmd; |
---|
| 222 | global $userid; |
---|
[6f17d76] | 223 | $response = Array(); |
---|
[e0b6a5e] | 224 | |
---|
[d8b6c70] | 225 | // Checking parameters. |
---|
[e0b6a5e] | 226 | try { |
---|
[2f11053] | 227 | if (!checkIds($ouid, $labid, $clntid)) { |
---|
[d8b6c70] | 228 | throw new Exception("Ids. must be positive integers"); |
---|
| 229 | } |
---|
| 230 | // Reading JSON parameters. |
---|
[e0b6a5e] | 231 | $input = json_decode($app->request()->getBody()); |
---|
| 232 | $urlLogin = htmlspecialchars($input->urlLogin); |
---|
| 233 | $urlLogout = htmlspecialchars($input->urlLogout); |
---|
[d8b6c70] | 234 | if (!filter_var($urlLogin, FILTER_VALIDATE_URL)) { |
---|
| 235 | throw new Exception("Must be a valid URL for login notification"); |
---|
| 236 | } |
---|
| 237 | if (!filter_var($urlLogout, FILTER_VALIDATE_URL)) { |
---|
| 238 | throw new Exception("Must be a valid URL for logout notification"); |
---|
| 239 | } |
---|
[e0b6a5e] | 240 | } catch (Exception $e) { |
---|
| 241 | // Error message. |
---|
| 242 | $response["message"] = $e->getMessage(); |
---|
| 243 | jsonResponse(400, $response); |
---|
| 244 | $app->stop(); |
---|
| 245 | } |
---|
| 246 | |
---|
| 247 | // Select client data for UDS compatibility. |
---|
| 248 | $cmd->texto = <<<EOD |
---|
[e7d47882] | 249 | SELECT adm.idadministradorcentro, ordenadores.idordenador, remotepc.* |
---|
[e0b6a5e] | 250 | FROM remotepc |
---|
| 251 | RIGHT JOIN ordenadores ON remotepc.id=ordenadores.idordenador |
---|
| 252 | JOIN aulas USING(idaula) |
---|
[e7d47882] | 253 | RIGHT JOIN administradores_centros AS adm USING(idcentro) |
---|
[e0b6a5e] | 254 | RIGHT JOIN usuarios USING(idusuario) |
---|
[e7d47882] | 255 | WHERE adm.idadministradorcentro = '$userid' |
---|
[e0b6a5e] | 256 | AND idcentro = '$ouid' AND aulas.idaula ='$labid' |
---|
| 257 | AND ordenadores.idordenador = '$clntid'; |
---|
| 258 | EOD; |
---|
| 259 | $rs=new Recordset; |
---|
| 260 | $rs->Comando=&$cmd; |
---|
| 261 | if (!$rs->Abrir()) return(false); // Error opening recordset. |
---|
[e7d47882] | 262 | // Check if user is admin and client exists. |
---|
[e0b6a5e] | 263 | $rs->Primero(); |
---|
[e7d47882] | 264 | if (checkAdmin($rs->campos["idadministradorcentro"]) and checkParameter($rs->campos["idordenador"])) { |
---|
[e0b6a5e] | 265 | // Check if client is reserved. |
---|
[d8b6c70] | 266 | if (! is_null($rs->campos["reserved"])) { |
---|
[9a39c75] | 267 | // Updating DB if client is reserved. |
---|
[d7352ab] | 268 | $cmd->CreaParametro("@urllogin", $urlLogin, 0); |
---|
| 269 | $cmd->CreaParametro("@urllogout", $urlLogout, 0); |
---|
[e0b6a5e] | 270 | $cmd->texto = <<<EOD |
---|
[63e439a] | 271 | UPDATE remotepc |
---|
| 272 | SET urllogin=@urllogin, urllogout=@urllogout |
---|
| 273 | WHERE id='$clntid'; |
---|
[9a39c75] | 274 | EOD; |
---|
[d7352ab] | 275 | if ($cmd->Ejecutar()) { |
---|
| 276 | // Confirm operation. |
---|
| 277 | jsonResponse(200, ""); |
---|
| 278 | } else { |
---|
| 279 | // Error message. |
---|
| 280 | $response["message"] = "Database error"; |
---|
| 281 | jsonResponse(400, $response); |
---|
| 282 | $app->stop(); |
---|
| 283 | } |
---|
[e0b6a5e] | 284 | } else { |
---|
| 285 | // Error message. |
---|
[9a39c75] | 286 | $response["message"] = "Client is not reserved"; |
---|
[e0b6a5e] | 287 | jsonResponse(400, $response); |
---|
| 288 | $app->stop(); |
---|
| 289 | } |
---|
| 290 | } |
---|
| 291 | $rs->Cerrar(); |
---|
| 292 | } |
---|
| 293 | ); |
---|
| 294 | |
---|
| 295 | |
---|
| 296 | $app->post('/ous/:ouid/labs/:labid/clients/:clntid/session', 'validateApiKey', |
---|
| 297 | function($ouid, $imageid) use ($app) { |
---|
| 298 | } |
---|
| 299 | ); |
---|
| 300 | |
---|
| 301 | |
---|
[9a39c75] | 302 | $app->delete('/ous/:ouid/labs/:labid/clients/:clntid/unreserve', 'validateApiKey', |
---|
[9ed6a67] | 303 | function($ouid, $labid, $clntid) { |
---|
[e0b6a5e] | 304 | global $cmd; |
---|
| 305 | global $userid; |
---|
[d7352ab] | 306 | global $ACCION_INICIADA; |
---|
[9ed6a67] | 307 | $response = Array(); |
---|
| 308 | $ogagent = Array(); |
---|
[e0b6a5e] | 309 | |
---|
[9ed6a67] | 310 | // Checking parameters. |
---|
[d8b6c70] | 311 | try { |
---|
[2f11053] | 312 | if (!checkIds($ouid, $labid, $clntid)) { |
---|
[d8b6c70] | 313 | throw new Exception("Ids. must be positive integers"); |
---|
| 314 | } |
---|
| 315 | } catch (Exception $e) { |
---|
| 316 | // Error message. |
---|
| 317 | $response["message"] = $e->getMessage(); |
---|
| 318 | jsonResponse(400, $response); |
---|
| 319 | $app->stop(); |
---|
| 320 | } |
---|
| 321 | |
---|
[9ed6a67] | 322 | // Select client data for UDS compatibility. |
---|
| 323 | $cmd->texto = <<<EOD |
---|
[e7d47882] | 324 | SELECT adm.idadministradorcentro, ordenadores.idordenador, ordenadores.ip, ordenadores.agentkey, remotepc.reserved |
---|
[9ed6a67] | 325 | FROM remotepc |
---|
| 326 | RIGHT JOIN ordenadores ON remotepc.id=ordenadores.idordenador |
---|
| 327 | JOIN aulas USING(idaula) |
---|
[e7d47882] | 328 | RIGHT JOIN administradores_centros AS adm USING(idcentro) |
---|
[9ed6a67] | 329 | RIGHT JOIN usuarios USING(idusuario) |
---|
[e7d47882] | 330 | WHERE adm.idadministradorcentro = '$userid' |
---|
[9ed6a67] | 331 | AND idcentro = '$ouid' AND aulas.idaula ='$labid' |
---|
| 332 | AND ordenadores.idordenador = '$clntid'; |
---|
| 333 | EOD; |
---|
| 334 | $rs=new Recordset; |
---|
| 335 | $rs->Comando=&$cmd; |
---|
| 336 | if (!$rs->Abrir()) return(false); // Error opening recordset. |
---|
[e7d47882] | 337 | // Check if user is admin and client exists. |
---|
[9ed6a67] | 338 | $rs->Primero(); |
---|
[e7d47882] | 339 | if (checkAdmin($rs->campos["idadministradorcentro"]) and checkParameter($rs->campos["idordenador"])) { |
---|
[9ed6a67] | 340 | // Check if client is reserved. |
---|
[d8b6c70] | 341 | if (! is_null($rs->campos["reserved"])) { |
---|
[9ed6a67] | 342 | // Read query data. |
---|
[40db2a3] | 343 | $clntip = $rs->campos["ip"]; |
---|
[9ed6a67] | 344 | $agentkey = $rs->campos["agentkey"]; |
---|
[63e439a] | 345 | // DB Transaction: set reservation time to the past and |
---|
[9ed6a67] | 346 | // remove pending boot commands from client's actions queue. |
---|
| 347 | $cmd->texto = "START TRANSACTION;"; |
---|
| 348 | $cmd->Ejecutar(); |
---|
| 349 | $cmd->texto = <<<EOD |
---|
| 350 | UPDATE remotepc |
---|
[63e439a] | 351 | SET reserved=NOW() - INTERVAL 1 SECOND, urllogin=NULL, urllogout=NULL |
---|
[9ed6a67] | 352 | WHERE id='$clntid'; |
---|
| 353 | EOD; |
---|
| 354 | $cmd->Ejecutar(); |
---|
| 355 | $cmd->texto = <<<EOD |
---|
| 356 | DELETE FROM acciones |
---|
| 357 | WHERE idordenador = '$clntid' |
---|
[35a63b6] | 358 | AND descriaccion = 'RemotePC Session'; |
---|
[9ed6a67] | 359 | EOD; |
---|
| 360 | $cmd->Ejecutar(); |
---|
| 361 | $cmd->texto = "COMMIT;"; |
---|
| 362 | $cmd->Ejecutar(); |
---|
| 363 | // Send a poweroff command to client's OGAgent. |
---|
| 364 | $ogagent[$clntip]['url'] = "https://$clntip:8000/opengnsys/poweroff"; |
---|
| 365 | $ogagent[$clntip]['header'] = Array("Authorization: ".$agentkey); |
---|
| 366 | $result = multiRequest($ogagent); |
---|
| 367 | // ... (check response) |
---|
[357352b] | 368 | //if ($result[$clntip]['code'] != 200) { |
---|
[9ed6a67] | 369 | // ... |
---|
| 370 | // Confirm operation. |
---|
| 371 | jsonResponse(200, ""); |
---|
| 372 | } else { |
---|
| 373 | // Error message. |
---|
| 374 | $response["message"] = "Client is not reserved"; |
---|
| 375 | jsonResponse(400, $response); |
---|
| 376 | } |
---|
| 377 | } |
---|
| 378 | $rs->Cerrar(); |
---|
[e0b6a5e] | 379 | } |
---|
| 380 | ); |
---|
| 381 | |
---|
| 382 | ?> |
---|