AnonSec Team
Server IP : 10.128.40.6  /  Your IP : 216.73.216.200
Web Server : Apache
System : Linux webd006.cluster128.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User : logmcpe ( 111175)
PHP Version : 7.3.33
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0705) :  /home/logmcpe/MC/../www/mcg/plugins/jszip/../../.github/../sms/../pages/python/../

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/logmcpe/MC/../www/mcg/plugins/jszip/../../.github/../sms/../pages/python/../client_gps.php
<?php
session_start();
include 'includes/config_tmcpro.php' ;
include 'includes/stable_functions_tmcpro.php' ;
function get_distance_m($lat1, $lng1, $lat2, $lng2) {
      $earth_radius = 6378137;   // Terre = sphère de 6378km de rayon
      $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 ($earth_radius * $d);
    }
	
	
	
$client_id1 = $client_id2 = 0;
// print_r($_POST);
	if(isset($_POST['client_id1']) && isset($_POST['client_id2']) && $_POST['client_id1'] > 0 && $_POST['client_id2'] > 0) 
{
	$client_id1 = $_POST['client_id1'];
	$client_id2 = $_POST['client_id2'];
	
	$cl1 = dbi_fetch_row( dbi_query("SELECT * FROM client  WHERE client_statut =  '1' AND client_id = $client_id1  ORDER BY client_nom ASC")) ;
	$cl2 = dbi_fetch_row( dbi_query("SELECT * FROM client  WHERE client_statut =  '1' AND client_id = $client_id2  ORDER BY client_nom ASC")) ;
	
	$resultat = (round(get_distance_m($cl1['latitude'], $cl1['longitude'], $cl2['latitude'], $cl2['longitude']) / 1000, 3)). ' km';
	// echo $resultat;
}
?>
<html>

			<head>

			<?php include('header.php'); ?>


			</head> 
			
<body class="hold-transition sidebar-mini">	


								
<!-- Site wrapper -->
<div class="wrapper">

				<!-- TOP MENU -->
							  <nav class="main-header navbar navbar-expand navbar-white navbar-light">
							 <!-- Menu extensible -->
								<ul class="navbar-nav">

								  
								   </ul>

							 <!-- liens TOP MENU DROITE -->
							 
							 
								<ul class="navbar-nav ml-auto">
								  <li class="nav-item">
            <a href="login.php?dec=1" class="nav-link">
			
              <i class="nav-icon fas fa-power-off"></i>
                        
            
            </a>
          </li><!-- Placer ici l'élément à positionner à droite du TOP MENU -->
								</ul>
							  
							  </nav>
												  
  
<!-- BARRE DE NAVIGATION -->


<?php include('menu.php'); ?>


  



 <!-- DEMARRAGE DE LA PAGE PRINCIPALE -->
  <div class="content-wrapper">


				<section class="content">
					<div class="row">
						<div class="col-12">
							<div class="card">
								<div class="card-header">
									<h5 class="m-0"><i class="nav-icon fas fa-clinic-medical"></i> CALCULE DISTANCE ENTRE 2 CLIENTS</h5>
								</div>					
								<div class="card-body">
									

									<form  method="POST"  action="">	
										<div class="row">
										
										

												
										
												<div class="col-sm-6">
												  <div class="form-group">
													<label>Client 1 </label>
													<select class="form-control select2" style="width: 100%;" name="client_id1" id="client_id1">
													<option value="0" "selected";>------------ Choisir client 1 ----------- </option>
														<?php   $req =dbi_query("SELECT * FROM client  WHERE client_statut =  '1' ORDER BY client_nom ASC") ;
																while(  $cl=dbi_fetch_row($req)) { 
																if(!empty($cl['latitude']) && !empty($cl['longitude'])){
																?>
																<option value="<?php echo $cl['client_id'] ; ?>"  <?php if($cl['client_id'] == $client_id1) echo "selected"; ?>><?php echo $cl['client_nom'].''; ?></option>
																<?php   }}	?>
													</select>				
												  </div>
												</div>
												<div class="col-sm-6">
												  <div class="form-group">
													<label>Client 2 </label>
													<select class="form-control select2" style="width: 100%;" name="client_id2" id="client_id2">
													<option value="0" "selected";>------------ Choisir client 2 ----------- </option>
														<?php   $req =dbi_query("SELECT * FROM client  WHERE client_statut =  '1' ORDER BY client_nom ASC") ;
																while(  $cl=dbi_fetch_row($req)) { 
																if(!empty($cl['latitude']) && !empty($cl['longitude'])){
																?>
																<option value="<?php echo $cl['client_id'] ; ?>"  <?php if($cl['client_id'] == $client_id2) echo "selected"; ?>><?php echo $cl['client_nom'].''; ?></option>
																<?php   }}	?>
													</select>				
												  </div>
												</div>
												
											

										
										</div>
										<div class="row">
										
										

												
												<div class="col-sm-4">
												  <div class="form-group">
													<label> </label>
													<button type="submit" class="btn btn-primary">Calculer</button>				
												  </div>
												</div>
											

										
										</div>
										

									</form>
									<?php if(isset($resultat)) { ?>
			<div class="row">
				<div class="col-lg-6 col-6">

				</div>
				<div class="col-lg-3 col-6">
					<div class="small-box bg-info">
						<a href="#" class="small-box-footer">Distance  : 
							<h3><?php echo $resultat;?></h3>
						</a>
					</div>
				</div>

			</div>
									
									<?php } ?>

								    </div><!-- /.card-body -->
							    </div><!-- /.card card-primary card-outline -->
							</div> <!-- /.col-12 -->
						</div>  <!-- /.row -->
				</section> <!-- /.section -->
     


	
	</div>
  
  
<?php include('footerr.php'); ?>
<script type="text/javascript">
$(document).ready(function(){
    $('#myModal').on('show.bs.modal', function (e) {
        var rowid = $(e.relatedTarget).data('id');
        $.ajax({
            type : 'post',
            url : 'ajaxAjoutMatR.php', //Here you will fetch records 
            data :  'rowid='+ rowid, //Pass $id
            success : function(data){
            $('#fetch').html(data);//Show fetched data from database
            }
        });
     });
});

    
</script>

</body>
</html>

AnonSec - 2021