Hide password and host to the database by updating .drone.yaml
continuous-integration/drone/push Build was killed Details

remotes/origin/mvc-implementation
Dorian HODIN 2 years ago
parent 3a0c62040e
commit 1744754dd4

@ -74,4 +74,21 @@ steps:
CONTAINERNAME: php_script
COMMAND: create
OVERWRITE: true
depends_on: [ php_script ]
depends_on: [ php_script ]
#database container
- name: deploy-php-database
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
environment:
IMAGENAME: innodb
CONTAINERNAME: location_php_database
COMMAND: create
PRIVATE: true
CODEFIRST_CLIENTDRONE_ENV_INNONDB_HOST:
from_secret: db_host
CODEFIRST_CLIENTDRONE_ENV_INNODB_DATABASE:
from_secret: db_database
CODEFIRST_CLIENTDRONE_ENV_INNODB_USER:
from_secret: db_user
CODEFIRST_CLIENTDRONE_ENV_INNODB_PASSWORD:
from_secret: db_password

@ -1,5 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android" name="Android">
<configuration />
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
@ -7,7 +12,9 @@
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/.pub" />
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/.dart_tool" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="jdk" jdkName="Android API 33, extension level 3 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Dart Packages" level="project" />
</component>
</module>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PhpProjectSharedConfiguration" php_language_level="8.1">
<option name="suggestChangeDefaultLanguageLevel" value="false" />
</component>
</project>

@ -1,8 +1,8 @@
<?php
$username="dafldev";
$host="89.83.53.34";
$password="wrap";
$db_name="positiondaflmusic";
$username=CODEFIRST_CLIENTDRONE_ENV_INNODB_USER;
$host=CODEFIRST_CLIENTDRONE_ENV_INNONDB_HOST;
$password=CODEFIRST_CLIENTDRONE_ENV_INNODB_PASSWORD;
$db_name=CODEFIRST_CLIENTDRONE_ENV_INNODB_DATABASE;
$connect=mysqli_connect($host,$username,$password,$db_name);
/*

@ -1,7 +1,7 @@
<?php
$dns = 'mysql:host=89.83.53.34;dbname=positiondaflmusic';
$user = 'dafldev';
$password = 'wrap';
$dns = 'mysql:host='.CODEFIRST_CLIENTDRONE_ENV_INNONDB_HOST.';dbname='.CODEFIRST_CLIENTDRONE_ENV_INNODB_DATABASE;
$user = CODEFIRST_CLIENTDRONE_ENV_INNODB_USER;
$password = CODEFIRST_CLIENTDRONE_ENV_INNODB_PASSWORD;
try{
$db = new PDO ($dns, $user, $password);
}catch( PDOException $e){

@ -1,24 +1,20 @@
<?php
class distance
function meters($lat1, $lng1, $lat2, $lng2): float
{
public function meters($lat1, $lng1, $lat2, $lng2): float
{
// Radius of the Earth in meters :
$earth_radius = 6378137;
// Calculation of the distance between 2 GPS coordinates:
$rlo1 = deg2rad($lng1);
$rla1 = deg2rad($lat1);
$rlo2 = deg2rad($lng2);
$rla2 = deg2rad($lat2);
$dlo = ($rlo2 - $rlo1) / 2;
$dla = ($rla2 - $rla1) / 2;
$a = (sin($dla) * sin($dla)) + cos($rla1) * cos($rla2) * (sin($dlo) * sin($dlo));
$d = 2 * atan2(sqrt($a), sqrt(1 - $a));
// Return the distance in meters between 2 GPS points
return round($earth_radius * $d);
}
// Radius of the Earth in meters :
$earth_radius = 6378137;
// Calculation of the distance between 2 GPS coordinates:
$rlo1 = deg2rad($lng1);
$rla1 = deg2rad($lat1);
$rlo2 = deg2rad($lng2);
$rla2 = deg2rad($lat2);
$dlo = ($rlo2 - $rlo1) / 2;
$dla = ($rla2 - $rla1) / 2;
$a = (sin($dla) * sin($dla)) + cos($rla1) * cos($rla2) * (sin($dlo) * sin($dlo));
$d = 2 * atan2(sqrt($a), sqrt(1 - $a));
// Return the distance in meters between 2 GPS points
return round($earth_radius * $d);
}
$db=0;
@ -50,7 +46,7 @@ Foreach ($row as $col) {
$lng2 = $col['longitude'];
$userID = $col['id'];
$idMusic = $col['idMusic'];
$dist = (new distance)->meters($lat1, $lng1, $lat2, $lng2);
$dist = meters($lat1, $lng1, $lat2, $lng2);
if ($dist <= 100) {
$listUser[] = ['user' => $userID, 'music' => $idMusic]; }
}

@ -1,5 +0,0 @@
<?php
echo "Hello world Dafl for PHP"
?>
Loading…
Cancel
Save