1, 'QIK' => 2, 'RASTR' => 3]; $nombre_portal = ['AUC' => 'ADOPTAUNCOCE.COM', 'QIK' => 'QUIKLY', 'RASTR' => 'RASTREATOR']; if(array_key_exists($_POST['portal'], $key_portal)) { $res = $bd_conn->query('SELECT VEHICULO FROM VEHICULOS_PUBLICACIONES WHERE VEHICULO = ' . $vehiculo . ' AND PORTAL = ' . $portal . ' AND ACTIVO = 1'); if($res->num_rows == 0) { $res = $bd_conn->query('INSERT INTO VEHICULOS_PUBLICACIONES(VEHICULO, PORTAL, INICIO, ACTIVO) VALUES(' . $vehiculo . ', ' . $portal . ', "' . $date . '", 1)'); $data = [ 'key_car' => $vehiculo, 'portal' => $nombre_portal[$portal], 'status' => 'message: successful', 'message' => 'OK' ]; } else { $data = [ 'status' => 'message: warning', 'message' => 'Car already published on the portal' ]; } } else { $data = [ 'status' => 'message: error', 'message' => 'Portal not found' ]; } } else { $data = [ 'status' => 'message: error', 'message' => 'Car or portal keys are empty' ]; } } else { $data = [ 'status' => 'message: error', 'message' => 'Car or portal keys not found' ]; } */ $data = [ 'status' => 'asdasdasdas', 'message' => 'fhfghfhfghfgh' ]; }elseif ($auth == 0) { $data = array(); $data[] = array ( "code" => "unauthorized_client", "message" => "Invalid authorization token" ); mysqli_close($bd_conn); } header("Content-type: application/json; charset=utf-8"); echo json_encode($data); ?>