Merge branch 'PHP_Script_on_Docker' into SQL_Script

remotes/origin/mvc-implementation
dorian.hodin 2 years ago
commit 3670ed8930

@ -1,25 +1,25 @@
<component name="libraryTable">
<library name="Dart SDK">
<CLASSES>
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/async" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/cli" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/collection" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/convert" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/core" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/developer" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/ffi" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/html" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/indexed_db" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/io" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/isolate" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/js" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/js_util" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/math" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/mirrors" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/svg" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/typed_data" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/web_audio" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/web_gl" />
<root url="file://$PROJECT_DIR$/../flutter/bin/cache/dart-sdk/lib/async" />
<root url="file://$PROJECT_DIR$/../flutter/bin/cache/dart-sdk/lib/cli" />
<root url="file://$PROJECT_DIR$/../flutter/bin/cache/dart-sdk/lib/collection" />
<root url="file://$PROJECT_DIR$/../flutter/bin/cache/dart-sdk/lib/convert" />
<root url="file://$PROJECT_DIR$/../flutter/bin/cache/dart-sdk/lib/core" />
<root url="file://$PROJECT_DIR$/../flutter/bin/cache/dart-sdk/lib/developer" />
<root url="file://$PROJECT_DIR$/../flutter/bin/cache/dart-sdk/lib/ffi" />
<root url="file://$PROJECT_DIR$/../flutter/bin/cache/dart-sdk/lib/html" />
<root url="file://$PROJECT_DIR$/../flutter/bin/cache/dart-sdk/lib/indexed_db" />
<root url="file://$PROJECT_DIR$/../flutter/bin/cache/dart-sdk/lib/io" />
<root url="file://$PROJECT_DIR$/../flutter/bin/cache/dart-sdk/lib/isolate" />
<root url="file://$PROJECT_DIR$/../flutter/bin/cache/dart-sdk/lib/js" />
<root url="file://$PROJECT_DIR$/../flutter/bin/cache/dart-sdk/lib/js_util" />
<root url="file://$PROJECT_DIR$/../flutter/bin/cache/dart-sdk/lib/math" />
<root url="file://$PROJECT_DIR$/../flutter/bin/cache/dart-sdk/lib/mirrors" />
<root url="file://$PROJECT_DIR$/../flutter/bin/cache/dart-sdk/lib/svg" />
<root url="file://$PROJECT_DIR$/../flutter/bin/cache/dart-sdk/lib/typed_data" />
<root url="file://$PROJECT_DIR$/../flutter/bin/cache/dart-sdk/lib/web_audio" />
<root url="file://$PROJECT_DIR$/../flutter/bin/cache/dart-sdk/lib/web_gl" />
</CLASSES>
<JAVADOC />
<SOURCES />

@ -1,23 +0,0 @@
<?php
function metersBetweenTwoUser($lat1, $lng1, $lat2, $lng2): float
{
$earth_radius = 6378137; // Radius of the Earth in meters :
$rlo1 = deg2rad($lng1); //Transform the coordinate longitude1 from degree to radian
$rla1 = deg2rad($lat1); //Transform the coordinate latitude1 from degree to radian
$rlo2 = deg2rad($lng2); //Transform the coordinate longitude2 from degree to radian
$rla2 = deg2rad($lat2); //Transform the coordinate latitude2 from degree to radian
$dlo = ($rlo2 - $rlo1) / 2; //Stock in $dlo the result of the calcul : ($rlo2 - $rlo1) / 2
$dla = ($rla2 - $rla1) / 2; //Stock in $dla the result of the calcul : ($rla2 - $rla1) / 2
$a = (sin($dla) * sin($dla)) + cos($rla1) * cos($rla2) * (sin($dlo) * sin($dlo)); //Do some operations to return the distance in meters
$d = 2 * atan2(sqrt($a), sqrt(1 - $a)); //Do some operations to return the distance in meters
return round($earth_radius * $d); // Return the distance in meters between 2 GPS points
}

@ -1,8 +1,28 @@
<?php
function metersBetweenTwoUser($lat1, $lng1, $lat2, $lng2): float
{
$earth_radius = 6378137; // Radius of the Earth in meters :
$rlo1 = deg2rad($lng1); //Transform the coordinate longitude1 from degree to radian
$rla1 = deg2rad($lat1); //Transform the coordinate latitude1 from degree to radian
$rlo2 = deg2rad($lng2); //Transform the coordinate longitude2 from degree to radian
$rla2 = deg2rad($lat2); //Transform the coordinate latitude2 from degree to radian
$dlo = ($rlo2 - $rlo1) / 2; //Stock in $dlo the result of the calcul : ($rlo2 - $rlo1) / 2
$dla = ($rla2 - $rla1) / 2; //Stock in $dla the result of the calcul : ($rla2 - $rla1) / 2
$a = (sin($dla) * sin($dla)) + cos($rla1) * cos($rla2) * (sin($dlo) * sin($dlo)); //Do some operations to return the distance in meters
$d = 2 * atan2(sqrt($a), sqrt(1 - $a)); //Do some operations to return the distance in meters
return round($earth_radius * $d); // Return the distance in meters between 2 GPS points
}
function insertUserAndReturnList(): array|int
{
include "config.php";
$res = connection();
if ($res == -1) {
@ -58,7 +78,7 @@ function insertUserAndReturnList(): array|int
}
}
return (json_encode($listUser)); //Return an encode array in json, so flutter ca=n interpret it
return $listUser; //Return an encode array in json, so flutter ca=n interpret it
} else { //If the method POST return nothing
@ -66,3 +86,5 @@ function insertUserAndReturnList(): array|int
}
}
print(json_encode(insertUserAndReturnList()));

Loading…
Cancel
Save