diff --git a/.drone.yml b/.drone.yml index bc3505d..7ba4a1b 100644 --- a/.drone.yml +++ b/.drone.yml @@ -2,6 +2,7 @@ kind: pipeline type: docker name: DAFLPipeline + trigger: event: - push @@ -52,3 +53,55 @@ steps: COMMAND: create OVERWRITE: true depends_on: [ web-server ] + +# docker image build +- name: php_script + image: plugins/docker + settings: + dockerfile: ./Sources/php_script/Dockerfile + context: Sources/php_script + registry: hub.codefirst.iut.uca.fr + repo: hub.codefirst.iut.uca.fr/dorian.hodin/dafl_music + username: + from_secret: SECRET_USERNAME + password: + from_secret: SECRET_PASSWD + +# container deployment +- name: deploy-php + image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest + environment: + IMAGENAME: hub.codefirst.iut.uca.fr/dorian.hodin/dafl_music:latest + CONTAINERNAME: php_script + COMMAND: create + OVERWRITE: true + CODEFIRST_CLIENTDRONE_ENV_HOST: + from_secret: db_host + CODEFIRST_CLIENTDRONE_ENV_DATABASE: + from_secret: db_database + CODEFIRST_CLIENTDRONE_ENV_USER: + from_secret: db_user + CODEFIRST_CLIENTDRONE_ENV_PASSWORD: + from_secret: db_password + CODEFIRST_CLIENTDRONE_ENV_ROOT_PASSWORD: + from_secret: db_root_password + depends_on: [ php_script ] + +# database container deployment +- name: db_location + image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest + environment: + IMAGENAME: mariadb:10.5 + CONTAINERNAME: mysql_location + COMMAND: create + # OVERWRITE: true + PRIVATE: true + CODEFIRST_CLIENTDRONE_ENV_MARIADB_ROOT_PASSWORD: + from_secret: db_root_password + CODEFIRST_CLIENTDRONE_ENV_MARIADB_DATABASE: + from_secret: db_database + CODEFIRST_CLIENTDRONE_ENV_MARIADB_USER: + from_secret: db_user + CODEFIRST_CLIENTDRONE_ENV_MARIADB_PASSWORD: + from_secret: db_password + depends_on: [ deploy-php ] \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index 7643783..6db4707 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -98,7 +98,6 @@ http://schemas.android.com/apk/res/android - ANDROID_ATTRIBUTE_ORDER
diff --git a/.idea/dafl_music.iml b/.idea/dafl_music.iml new file mode 100644 index 0000000..98db980 --- /dev/null +++ b/.idea/dafl_music.iml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/dataSources.local.xml b/.idea/dataSources.local.xml new file mode 100644 index 0000000..e794de1 --- /dev/null +++ b/.idea/dataSources.local.xml @@ -0,0 +1,10 @@ + + + + + + forget + + + + \ No newline at end of file diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml new file mode 100644 index 0000000..dfa1771 --- /dev/null +++ b/.idea/dataSources.xml @@ -0,0 +1,12 @@ + + + + + mariadb + true + org.mariadb.jdbc.Driver + jdbc:mariadb://localhost:3306 + $ProjectFileDir$ + + + \ No newline at end of file diff --git a/.idea/dataSources/f334e98a-3c30-4412-8c71-35fe124ed605.xml b/.idea/dataSources/f334e98a-3c30-4412-8c71-35fe124ed605.xml new file mode 100644 index 0000000..b6cbbc9 --- /dev/null +++ b/.idea/dataSources/f334e98a-3c30-4412-8c71-35fe124ed605.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/dataSources/f334e98a-3c30-4412-8c71-35fe124ed605/storage_v2/_src_/schema/information_schema.FNRwLQ.meta b/.idea/dataSources/f334e98a-3c30-4412-8c71-35fe124ed605/storage_v2/_src_/schema/information_schema.FNRwLQ.meta new file mode 100644 index 0000000..1ff3db2 --- /dev/null +++ b/.idea/dataSources/f334e98a-3c30-4412-8c71-35fe124ed605/storage_v2/_src_/schema/information_schema.FNRwLQ.meta @@ -0,0 +1,2 @@ +#n:information_schema +! [null, 0, null, null, -2147483648, -2147483648] diff --git a/.idea/dataSources/f334e98a-3c30-4412-8c71-35fe124ed605/storage_v2/_src_/schema/mysql.osA4Bg.meta b/.idea/dataSources/f334e98a-3c30-4412-8c71-35fe124ed605/storage_v2/_src_/schema/mysql.osA4Bg.meta new file mode 100644 index 0000000..86a53f1 --- /dev/null +++ b/.idea/dataSources/f334e98a-3c30-4412-8c71-35fe124ed605/storage_v2/_src_/schema/mysql.osA4Bg.meta @@ -0,0 +1,2 @@ +#n:mysql +! [null, 0, null, null, -2147483648, -2147483648] diff --git a/.idea/dataSources/f334e98a-3c30-4412-8c71-35fe124ed605/storage_v2/_src_/schema/performance_schema.kIw0nw.meta b/.idea/dataSources/f334e98a-3c30-4412-8c71-35fe124ed605/storage_v2/_src_/schema/performance_schema.kIw0nw.meta new file mode 100644 index 0000000..9394db1 --- /dev/null +++ b/.idea/dataSources/f334e98a-3c30-4412-8c71-35fe124ed605/storage_v2/_src_/schema/performance_schema.kIw0nw.meta @@ -0,0 +1,2 @@ +#n:performance_schema +! [null, 0, null, null, -2147483648, -2147483648] diff --git a/.idea/dbnavigator.xml b/.idea/dbnavigator.xml new file mode 100644 index 0000000..04cbe55 --- /dev/null +++ b/.idea/dbnavigator.xml @@ -0,0 +1,417 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml new file mode 100644 index 0000000..fc497d8 --- /dev/null +++ b/.idea/libraries/Dart_Packages.xml @@ -0,0 +1,724 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..639900d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index 85c8ded..c753441 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml new file mode 100644 index 0000000..97a38d7 --- /dev/null +++ b/.idea/php.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/sqldialects.xml b/.idea/sqldialects.xml new file mode 100644 index 0000000..e2a1e75 --- /dev/null +++ b/.idea/sqldialects.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Documentation/Images/MQTT.png b/Documentation/Images/MQTT.png new file mode 100644 index 0000000..d1014c8 Binary files /dev/null and b/Documentation/Images/MQTT.png differ diff --git a/Sources/dafl_project_flutter/lib/services/position/area.dart b/Sources/dafl_project_flutter/lib/services/position/area.dart index fbf102a..506f0ab 100644 --- a/Sources/dafl_project_flutter/lib/services/position/area.dart +++ b/Sources/dafl_project_flutter/lib/services/position/area.dart @@ -2,41 +2,53 @@ import 'package:geolocator/geolocator.dart'; import 'package:http/http.dart' as http; import 'dart:convert'; import 'dart:async'; - import '../../main.dart'; import '../../model/spot.dart'; -class Area { - late List spots; +class Location { + static Future> sendCurrentLocation() async { - sendCurrentLocation() async { - Uri uri = Uri.parse("http://89.83.53.34/phpmyadmin/dafldev/insert.php"); + Uri uri = Uri.parse("https://codefirst.iut.uca.fr/containers/php_script-dorianhodin/insertAndMakeListUser.php"); + Map spot = {}; LocationPermission permission; + permission = await Geolocator.checkPermission(); + if (permission == LocationPermission.denied) { + permission = await Geolocator.requestPermission(); + if (permission == LocationPermission.deniedForever) { //TODO : handle this case } } - String actualUser = MyApp.controller.getIdSpotify(); - String actualSong = await MyApp.controller.getCurrentMusic(); + + String actualUser = MyApp.controller.currentUser.usernameDafl; + String actualSong = await MyApp.api.getCurrentlyPlayingTrack(); Position current = await Geolocator.getCurrentPosition(); - await http.post(uri, body: { - "id": actualUser, + + http.Response response = await http.post(uri, body: { + "id": actualUser.toString(), "latitude": current.latitude.toString(), "longitude": current.longitude.toString(), - "idMusic": actualSong + "idMusic": actualSong.toString(), }); - } - getData() async { - String actualUser = MyApp.controller.getIdDafl().toString(); - Uri uri = Uri.parse("http://89.83.53.34/phpmyadmin/dafldev/distance.php"); - http.Response response = await http.post(uri, body: { - "id": actualUser, - }); var data = jsonDecode(response.body); - data.forEach((s) => spots.add(Spot(s['user'], s['music']))); + + if (data == 2){ + + return Future.error("Failed to connect, connection timeout"); + + }else if (data == 3) { + + return Future.error("POST method failed"); + + }else{ + + data.forEach((s) => spot.putIfAbsent(s['user'], () => s['music'])); + return spot; + + } } -} +} \ No newline at end of file diff --git a/Sources/dafl_project_flutter/lib/views/pages/main/w_profile.dart b/Sources/dafl_project_flutter/lib/views/pages/main/w_profile.dart index 5e78ab7..80b8e4e 100644 --- a/Sources/dafl_project_flutter/lib/views/pages/main/w_profile.dart +++ b/Sources/dafl_project_flutter/lib/views/pages/main/w_profile.dart @@ -1,3 +1,5 @@ +import 'package:text_scroll/text_scroll.dart'; +import 'package:scroll_loop_auto_scroll/scroll_loop_auto_scroll.dart'; import '../../../main.dart'; import '../../../model/music.dart'; import './w_settings.dart'; @@ -27,8 +29,13 @@ class MainPageProfil extends StatefulWidget { } class _MainPageProfilState extends State { - late String username; - late Music currentmusic; + String? username = MyApp.controller.currentUser.usernameDafl; + late Future data; + + Future getdata() async { + return MyApp.api.getTrackInfo( await MyApp.api.getCurrentlyPlayingTrack()); + + } @override initState() async { @@ -226,53 +233,123 @@ class _MainPageProfilState extends State { ), ], ), - Container( - margin: const EdgeInsets.fromLTRB(0, 10, 0, 0), - height: height * 0.14, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15.0), - color: const Color(0xFFD9D9D9).withOpacity(0.08), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - margin: const EdgeInsets.fromLTRB(15, 0, 0, 0), - child: ClipRRect( - borderRadius: BorderRadius.circular(15), - child: FadeInImage.assetNetwork( - height: 90, - width: 90, - placeholder: - "assets/images/loadingPlaceholder.gif", - image: currentmusic.linkCover))), - Container( - margin: const EdgeInsets.fromLTRB(12, 20, 0, 0), - child: Column( + FutureBuilder( + future: getdata(), + builder: (context, snapshot){ + if(snapshot.connectionState == ConnectionState.done){ + return Container( + margin: const EdgeInsets.fromLTRB(0, 10, 0, 0), + height: height * 0.14, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15.0), + color: const Color(0xFFD9D9D9).withOpacity(0.08), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + margin: const EdgeInsets.fromLTRB(15, 0, 0, 0), + child: ClipRRect( + borderRadius: BorderRadius.circular(10), + child: Image.network(snapshot.data!['cover'], + height: 90, + width: 90, + ))), + Container( + margin: const EdgeInsets.fromLTRB(12, 20, 0, 0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + snapshot.data!['name'].length > 22? + SizedBox(width: 220, + child: ScrollLoopAutoScroll( + delayAfterScrollInput: Duration(seconds: 1), + delay: Duration(seconds: 1), + child: Text( + snapshot.data!['name'], + style: TextStyle(fontSize: 20, + color: Colors.white, + fontWeight: FontWeight.bold), + ), + duration: Duration(seconds: 100), + scrollDirection: Axis.horizontal, + ),) + :Text( + snapshot.data!['name'], + style: TextStyle(fontSize: 20, + color: Colors.white, + fontWeight: FontWeight.bold), + ), + + + Text( + snapshot.data!['artist'], + style: const TextStyle( + fontSize: 16, + fontWeight: FontWeight.w400, + color: Colors.grey), + ), + ], + ), + ) + ], + ), + ); + } + else{ + return Container( + margin: const EdgeInsets.fromLTRB(0, 10, 0, 0), + height: height * 0.14, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15.0), + color: const Color(0xFFD9D9D9).withOpacity(0.08), + ), + child: Row( mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - Text( - currentmusic.name, - style: const TextStyle( - fontSize: 18, - fontWeight: FontWeight.w500, - color: Colors.white), - ), - Text( - currentmusic.artist, - style: const TextStyle( - fontSize: 16, - fontWeight: FontWeight.w400, - color: Colors.grey), - ), + Container( + margin: const EdgeInsets.fromLTRB(15, 0, 0, 0), + child: ClipRRect( + borderRadius: BorderRadius.circular(10), + child: Image.asset("assets/images/loadingPlaceholder.gif", + height: 90, + width: 90))), + Container( + margin: const EdgeInsets.fromLTRB(12, 20, 0, 0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 150, + height: 20, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + color: Colors.grey.withOpacity(0.7), + ), + ), + SizedBox(height: 10,), + Container( + width: 100, + height: 20, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + color: Colors.grey.withOpacity(0.4), + ), + ), + ], + ), + ) ], ), - ) - ], - ), - ), + ); + } + + }) + , ], ), ), diff --git a/Sources/dafl_project_flutter/lib/views/pages/main/w_spot.dart b/Sources/dafl_project_flutter/lib/views/pages/main/w_spot.dart index 5508ada..e0cd2d7 100644 --- a/Sources/dafl_project_flutter/lib/views/pages/main/w_spot.dart +++ b/Sources/dafl_project_flutter/lib/views/pages/main/w_spot.dart @@ -162,6 +162,35 @@ class _SpotsWidgetState extends State { )), ), ), + MyApp.controller.currentUser.spots.isEmpty? + SafeArea(child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + MyApp.controller.currentUser.spots.isEmpty? + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text( + 'Quelques instants...', + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.w500, + fontSize: 25), + ), + const Padding(padding: EdgeInsets.fromLTRB(0, 5, 0, 0)), + Text( + 'Nous cherchons des profils a vous proposer.', + style: TextStyle( + color: Colors.grey.withOpacity(0.4), fontSize: 15), + ), + ], + ) : + Container(), + + ] + ) + ),): Padding( padding: const EdgeInsets.fromLTRB(20, 60, 0, 0), child: Column( diff --git a/Sources/dafl_project_flutter/pubspec.lock b/Sources/dafl_project_flutter/pubspec.lock index 3d63a15..91ffce2 100644 --- a/Sources/dafl_project_flutter/pubspec.lock +++ b/Sources/dafl_project_flutter/pubspec.lock @@ -141,6 +141,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0" + fading_edge_scrollview: + dependency: transitive + description: + name: fading_edge_scrollview + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.0" fake_async: dependency: transitive description: @@ -378,6 +385,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0" + marquee: + dependency: "direct main" + description: + name: marquee + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.3" matcher: dependency: transitive description: @@ -553,6 +567,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.9.1" + scroll_loop_auto_scroll: + dependency: "direct main" + description: + name: scroll_loop_auto_scroll + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.5" sky_engine: dependency: transitive description: flutter @@ -607,6 +628,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.3" + text_scroll: + dependency: "direct main" + description: + name: text_scroll + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.1" typed_data: dependency: transitive description: diff --git a/Sources/dafl_project_flutter/pubspec.yaml b/Sources/dafl_project_flutter/pubspec.yaml index 59c174d..94505a7 100644 --- a/Sources/dafl_project_flutter/pubspec.yaml +++ b/Sources/dafl_project_flutter/pubspec.yaml @@ -30,6 +30,9 @@ dependencies: geolocator: ^9.0.2 flutter_styled_toast: ^2.1.3 flutter_gen: ^5.1.0+1 + marquee: ^2.2.3 + text_scroll: ^0.1.1 + scroll_loop_auto_scroll: ^0.0.2 dev_dependencies: flutter_test: diff --git a/Sources/db_script/sql/create.sql b/Sources/db_script/sql/create.sql new file mode 100644 index 0000000..9f79c1e --- /dev/null +++ b/Sources/db_script/sql/create.sql @@ -0,0 +1,50 @@ +CREATE TABLE UserDafl( + idDafl INT PRIMARY KEY, + pseudo varchar(50) NOT NULL, + idSpotify varchar(150) NOT NULL, + profilPicture varchar(200) NOT NULL +); + +CREATE TABLE Musique( + idUser INT REFERENCES User(idDafl), + idMusic INT, + title varchar(50) NOT NULL, + artist varchar(50) NOT NULL, + album varchar(50) NOT NULL, + category varchar(100), + PRIMARY KEY(idUser,idMusic) +); + +CREATE TABLE Matchs( + idUserA INT REFERENCES User(idDafl), + idUserB INT REFERENCES User(idDafl), + dateMatch date NOT NULL, + PRIMARY KEY(idUserA,idUserB) +); + +CREATE TABLE LikeDafl( + idUserWhoLike INT REFERENCES User(idDafl), + idUserWhoGetLike INT REFERENCES User(idDafl), + dateLike date NOT NULL, + PRIMARY KEY(idUserWhoLike,idUserWhoGetLike) +); + +CREATE TABLE MessageDafl( + senderID INT NOT NULL REFERENCES User(idDafl) , + idMessage INT PRIMARY KEY, + content varchar(500), + dateMess date NOT NULL +); + +CREATE TABLE ConversationDafl( + idUserA INT NOT NULL REFERENCES User(idDafl), + idUserB INT NOT NULL REFERENCES User(idDafl), + idConversation INT PRIMARY KEY, + waiting BOOLEAN NOT NULL CHECK (waiting=1 OR waiting=0) +); + +CREATE TABLE MessToConv( + idConv INT REFERENCES Conversation(idConversation), + idMsg INT REFERENCES Message(idMessage), + PRIMARY KEY (idConv,idMsg) +); \ No newline at end of file diff --git a/Sources/php_script/Dockerfile b/Sources/php_script/Dockerfile new file mode 100644 index 0000000..31a3d12 --- /dev/null +++ b/Sources/php_script/Dockerfile @@ -0,0 +1,4 @@ +FROM php:8.1-apache +RUN apt-get update && apt-get upgrade -y +RUN docker-php-ext-install mysqli +COPY ./script /var/www/html diff --git a/Sources/php_script/script/config.php b/Sources/php_script/script/config.php new file mode 100644 index 0000000..10e0879 --- /dev/null +++ b/Sources/php_script/script/config.php @@ -0,0 +1,23 @@ +10);"; + mysqli_query($res, $query); + + $query = "SELECT id FROM gps WHERE id = '$id' "; + $results = mysqli_query($res, $query); //Execute the SQL command + + if (empty($results->fetch_row()[0])){ + + $query = "INSERT INTO gps(id,latitude,longitude,idMusic,dateLog) VALUES('$id','$latitude','$longitude','$idMusic',NOW());"; //Insert into the database the new data and new information about this user + + }else{ + + $query = "UPDATE gps SET latitude='$latitude', longitude='$longitude', idMusic='$idMusic', dateLog=NOW() WHERE id='$id'"; //Delete the actual line and replace this line with the next lines + + } + + mysqli_query($res, $query); + + $query = "SELECT * FROM gps WHERE id != '$id'"; //Browse all the database + $results = mysqli_query($res, $query); //Execute the SQL command + $listUser = []; //Set the listUser to an empty list + + while ($row = $results->fetch_row()) { //For all the row in the database + + $lat2 = $row[1]; //Set $lat2 to the latitude of the user who is in the actual row + $lng2 = $row[2]; //Set $lng2 to the latitude of the user who is in the actual row + $userID = $row[0]; //Set $userID to the username of the user who is in the actual row + $idMusic = $row[3]; //Set $idMusic to the id of the actual song of the user who is in the actual row + + $dist = metersBetweenTwoUser($latitude, $longitude, $lat2, $lng2); //With the function meters, determinate the distance between the current user and the user who is in the actual row + + if ($dist <= 100) { //If the user in the actual row is less than 100 meters away of the current user + + $listUser[] = ['user' => $userID, 'music' => $idMusic]; //Add the username and the ID of the song that user who is in the actual row is listening + + } + } + return $listUser; //Return an array + + } else { //If the method POST return nothing + + return 3; //Return a code error + + } +} + +print(json_encode(insertUserAndReturnList()));