AnonSec Team
Server IP : 10.128.40.6  /  Your IP : 216.73.216.233
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 (0755) :  /home/logmcpe/www/TEST/../TMCPRO/pages/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/logmcpe/www/TEST/../TMCPRO/pages/anomalie_inverse.php
<?php


include 'includes/config_tmcpro.php' ;
	include 'includes/stable_functions_tmcpro.php' ;
	
	



if(!empty($_POST['heure_debut_modale'] ) AND !empty($_POST['heure_fin_modale'] ) ){
	
// echo "<pre>" ;
// print_r($_POST) ;
// echo "</pre>" ;
	// exit() ; 
	
	dbi_query("UPDATE `telepointage` SET `heure` = '".$_POST['heure_debut_modale']."' WHERE `telepointage`.`id_p` =".$_POST['id_debut']) ; 
	dbi_query("UPDATE `telepointage` SET `heure` = '".$_POST['heure_fin_modale']."' WHERE `telepointage`.`id_p` =".$_POST['id_fin']) ; 
	header('Location:anomalie_inverse.php?msg=Pointages bien modifié&color=success');
	
}


session_start();
// $a= gmdate("01:00:00", s);
//l echo "==> $a <br/>" ;
// exit(l)l ;



										$_SESSION["id_etab"]= 111 ;



										if(!empty( $_GET["id_etab"]))
										{
										$_SESSION["id_etab"] = $_GET["id_etab"];
										}


										if($_SESSION["id_etab"]== 111){
											$where_etablissement_id="" ;
										}
										else{
										$where_etablissement_id = " AND c.etablissement_id = ".$_SESSION["id_etab"] ;
										}


if(empty($_SESSION['datej'])){$_SESSION['datej'] = date('Ymd');} ;


// exit() ; // $date_jour = date('Ymd');
// echo int2date($date_jour );
if(isset($_POST['date_jour']))
{
	$_SESSION['datej'] = dateformaint($_POST['date_jour']);
}



$date_jour = $_SESSION['datej'] ;


// echo "<pre>" ;
// print_r($_SESSION) ;
// echo "</pre>" ;

// echo "========> ".$date_jour."<br/>" ;


// Start the session




function diff_time($t1 , $t2){
     //Heures au format (hh:mm:ss) la plus grande puis le plus petite

       $tab=explode(":", $t1);
       $tab2=explode(":", $t2);

       $h=$tab[0];
       $m=$tab[1];
       $s=$tab[2];
       $h2=$tab2[0];
       $m2=$tab2[1];
       $s2=$tab2[2];

       if ($h2>$h) {
       $h=$h+24;
       }
       if ($m2>$m) {
       $m=$m+60;
       $h2++;
       }
       if ($s2>$s) {
       $s=$s+60;
       $m2++;
       }

       $ht=$h-$h2;
       $mt=$m-$m2;
       $st=$s-$s2;
       if (strlen($ht)==1) {
       $ht="0".$ht;
       }
       if (strlen($mt)==1) {
       $mt="0".$mt;
       }
       if (strlen($st)==1) {
       $st="0".$st;
       }
       return $ht.":".$mt.":".$st;

    }


	 // $uuu = diff_time('05:02:00' , '06:00:00') ;

	// echo "$uuu<br/>" ;
	
	// $test = "06:30" ; 
	// echo "==>".heure2int($test) ; 
	// exit() ;


// mise a jour de la table télépoinatage ( ajout de id client pour chaqur pointage)


$qo =dbi_query("SELECT *  FROM `telepointage` WHERE jour >= 20210801 AND (`client_id` IS NULL OR client_id = 0 )") ;
while($j= dbi_fetch_row($qo))
{

    $telephone= $j['telephone'] ;

	list($client_id) = dbi_fetch_row(dbi_query("SELECT client_id FROM `client` WHERE `tele1` LIKE '$telephone'  or `tele2` LIKE '$telephone' or `tele3` LIKE '$telephone' or `tele4` LIKE '$telephone' or `tele5` LIKE '$telephone' ")) ;

// echo "$telephone ==> $client_id	<br/>" ;

 dbi_query("UPDATE `telepointage` SET `client_id` = '$client_id' WHERE `id_p` = ".$j['id_p'] );



}

// echo $date_jour ;
?>
<html>
<head>
<?php include('header.php'); ?>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css">
    <script type='text/javascript' src='jquery-3.6.0.min.js'></script>
</head>

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

<div class="wrapper">


												<nav class="main-header navbar navbar-expand navbar-white navbar-light">
													<ul class="navbar-nav">
															<li class="nav-item">
																	<a class="nav-link" data-widget="pushmenu" href="#"><i class="fas fa-bars"></i></a>
															</li>


													</ul>
												</nav>


<!-- BARRE DE NAVIGATION -->

<aside class="main-sidebar sidebar-dark-primary elevation-4">

	<!-- Brand Logo -->
	<a href="index3.html" class="brand-link">
		<img src="dist/img/logomcpro.png" alt="AdminLTE Logo" class="brand-image img-circle elevation-3"
				 style="opacity: .8">
		<span class="brand-text font-weight-light">MC PRO</span>
	</a>

	<!-- Sidebar -->
	<div class="sidebar">
		<!-- Sidebar user panel (optional) -->
		<div class="user-panel mt-3 pb-3 mb-3 d-flex">
			<div class="image">
				<img src="dist/img/user2-160x160.jpg" class="img-circle elevation-2" alt="User Image">
			</div>
			<div class="info">
				<a href="#" class="d-block">Steeven ROBLOT</a>
			</div>
		</div>

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

		<!-- Sidebar Menu -->

	</div>
	<!-- /.sidebar -->
</aside>


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

		<section class="content-header">
		 <div class="container-fluid">
			 <div class="row mb-2">
				 <div class="col-sm-6">
					 <h1>Anomalie ........... </h1>
				 </div>
				 <div class="col-sm-6">
					 <ol class="breadcrumb float-sm-right">
						 <li class="breadcrumb-item"><a href="index.php">Accueil</a></li>
						 <li class="breadcrumb-item"><a href="indexpointages3.php">Anomalie</a></li>
						 <li class="breadcrumb-item active">Anomalie ...... </li>
					 </ol>
				 </div>
			 </div>
		 </div><!-- /.container-fluid -->
		</section>

    <!-- Content Header (Page header) -->

													<div class="row mb-2">
																			<div  class="modal fade" id="myModal" role="dialog" class="modal fade task-modal-single in" tabindex="-1"  aria-labelledby="myLargeModalLabel" >
																			  <div class="modal-dialog modal-lg">
																				<div class="modal-content data">
																					<div id="fetch" >
																					</div>

																					</div>
																				</div>
																			</div>
													</div><!-- /.row -->

												<!-- /.content-header -->





				<section class="content">
					<div class="row">
						<div class="col-12">
							<div class="card">

									<div class="card-body">
									
												  		  <?php
			      if(isset($_GET["msg"])){
        ?>
        <div class="alert alert-<?php echo $_GET["color"]; ?>  alert-dismissible col-12" role="alert">
          <strong><?php echo $_GET["color"].': '; ?></strong><?php echo $_GET["msg"]; ?>.
          <button type="button" class="close" data-dismiss="alert" aria-label="Close">
            <span aria-hidden="true">&times;</span>
          </button>
        </div>
        <?php
        }

// if(!empty($_POST))
// {
// echo "<pre>" ;
// print_r($_POST) ;
// echo "<pre>" ;
// }

if(!empty($_POST))
{

	$an= $_POST['ans'] ;
	$mois =  $_POST['mois'] ;
// $ismai = $_POST['ans']."".$_POST['mois']  ;
$ismai =  $an."".$mois ;
$salarie_id=$_POST['salarie_id'] ;
// $qa = dbi_query(" SELECT * FROM `telepointage` where matricule = $salarie_id and `jour` LIKE '$ismai%' ORDER BY `telepointage`.`jour` DESC ,heure DESC ") ;


}





// echo "ppp=> $an <br/>" ;

// $a = dbi_query("SELEC * FROM `etablissement` $where1")

function dateDifference($date1, $date2)
{
    $first = DateTime::createFromFormat('m/d/Y', $date1);
    $second = DateTime::createFromFormat('m/d/Y', $date2);
    if($date1 > $date2) return week_between_two_dates($date2, $date1);
    return floor($first->diff($second)->days/7);
}



 ?>













							<form id="bureau_mois" name="mois_form" method="POST" action="">
							  <div class="form-row">

								<div class="form-group col-md-4">
									 <div class="input-group">
										<label></label>
								   </div>
								</div>

								<div class="form-group col-md-3">
									<div class="input-group">
										<div class="input-group-prepend"><span class="input-group-text"><i class="far fa-calendar-alt"></i></span></div>
										<input type="date" class="form-control" id="date_jour" name="date_jour" value='<?php echo int2date_autre_format($date_jour); ?>' placeholder="jj/mm/aaaa"/>
									</div>
								</div>





								<div class="form-group col-md-2">
									 <div class="input-group">
											<button type="submit" name="Afficher" class="btn btn-primary">Afficher </button>
								   </div>
								</div>
						</div>
						</form>





										<div class="onglet_dotted">
											<div style="width:100%; float:left; vertical-align:top" class="header_ray">
												<div id="tab">
													<div class="box-body">
														<table id="example1" class="table table-bordered table-striped">
															<thead>
																<TR>
																  <th align="center">Client</th>
																  <th align="center">Début</th>
																  <th align="center">Fin</th>
																  <th align="center">Salarié</th>
																    <th align="center">Arrivée</th>
																  <th align="center">Départ</th>
																  <th align="center">Action</th>


																</TR>
															</thead>
                                                            <tbody>

                                                            <?php
															

																$date = $date_jour;
																$i = 1;
																$q = dbi_query("
																	SELECT * FROM PRESTATIONS p,client c  where c.client_id=p.client_id AND client_statut = '1' AND client_acces_pointage ='2' AND presta_date_debut <= $date AND (p.presta_date_fin >= $date OR p.presta_date_fin IS NULL) $where_etablissement_id ORDER BY presta_Hdeb ASC

																");
																$chaine ="" ;
																	while($prest = dbi_fetch_row($q))
																{
																		$date_presta_sem = $prest['presta_date_debut'] ;
																		$q1 = dbi_query("SELECT * FROM PRESTATIONS_MODIF WHERE presta_id = ".$prest['presta_id']." order by start, modif_id ") ;
																		while (($m = dbi_fetch_row($q1)) && $date >= $m['start'])
																		{
																			if( $m['presta_sem'] != NULL ) $date_presta_sem = $m['start'];
																			$prest['salarie_id'] = $m['salarie_id'] === NULL ? $prest['salarie_id'] : $m['salarie_id'] ;
																			$prest['presta_sem'] = $m['presta_sem'] === NULL ? $prest['presta_sem'] : $m['presta_sem'] ;
																			$prest['presta_jour'] = $m['presta_jour'] === NULL ? $prest['presta_jour'] : $m['presta_jour'] ;
																			$prest['presta_Hdeb'] = $m['presta_Hdeb'] === NULL ? $prest['presta_Hdeb'] : $m['presta_Hdeb'] ;
																			$prest['presta_Hduree'] = $m['presta_Hduree'] === NULL ? $prest['presta_Hduree'] : $m['presta_Hduree'] ;
																			$prest['chantier_id'] = $m['chantier_id'] === NULL ? $prest['chantier_id'] : $m['chantier_id'] ;
																			$prest['presta_forfait'] = $m['presta_forfait'] === NULL ? $prest['presta_forfait'] : $m['presta_forfait'] ;
																		}
																				// if( $prest['salarie_id'] == $salarie_id ) {
																					$day = date("w", strtotime( int2date_autre_format($date)));
																					// if( $day == $prest['presta_jour']){
																					if( $day == $prest['presta_jour'] OR  ( $date == $prest['presta_date_debut'] &&  $prest['presta_date_debut']	== $prest['presta_date_fin'] ) ){

																						$EXP = dbi_fetch_row(dbi_query("SELECT date_presta FROM EXCEPTIONS WHERE presta_id = ".$prest['presta_id']." AND date_presta = ".$date." " )) ;	   ;
																						if($EXP ){}   else {
																							if( $prest['presta_sem'] == 1 )
																							{
																								$SAL = dbi_fetch_row(dbi_query("SELECT * FROM salarie WHERE salarie_id = ".$prest['salarie_id'] ." " )) ;
																								   // $Clt = dbi_fetch_row(dbi_query("SELECT * FROM client WHERE client_id = ".$prest['client_id'] ." " )) ;
																									// $chaine =  " $i".' -La prestation Débute avec <strong>'.$prest["client_nom"]."</strong> de <strong>".int2heure($prest['presta_Hdeb'])."</strong> à <strong>".int2heure(addDuree($prest['presta_Hdeb'], $prest['presta_Hduree']))."</strong> ** ".$SAL["salarie_nom"]." ** <br/>";

																								// echo "==> ".$prest['salarie_id']."  ==> ".$prest['client_id']."<br/>" ;

																									list($cmpt_heureD) = dbi_fetch_row( dbi_query("SELECT count(heure) FROM `telepointage` WHERE `jour` LIKE '$date' AND `matricule` =".$prest['salarie_id']." AND `client_id` = ".$prest['client_id']." AND `action` LIKE 'DEBUT'  AND pointage_valider = 0 ")) ;
																								    list($cmpt_heureF) = dbi_fetch_row(dbi_query("SELECT count(heure) FROM `telepointage` WHERE `jour` LIKE '$date' AND `matricule` =".$prest['salarie_id']." AND `client_id` = ".$prest['client_id']." AND `action` LIKE 'FIN'  AND pointage_valider = 0 "    )) ;
                                                                                                  
																								 list($heureD,$id_pDD , $presta_idDD) = dbi_fetch_row(dbi_query("SELECT heure , id_p, presta_id  FROM `telepointage` WHERE `jour` LIKE '$date' AND `matricule` =".$prest['salarie_id']." AND `client_id` = ".$prest['client_id']." AND `action` LIKE 'DEBUT' and (presta_id = ".$prest['presta_id']." OR presta_id = 0) ")) ;
																								 list($heureF,$id_pFF ,$presta_idFF ) = dbi_fetch_row(dbi_query("SELECT heure , id_p, presta_id  FROM `telepointage` WHERE `jour` LIKE '$date' AND `matricule` =".$prest['salarie_id']." AND `client_id` = ".$prest['client_id']." AND `action` LIKE 'FIN'   and (presta_id = ".$prest['presta_id']." OR presta_id = 0) ")) ;
                                                                                                  // echo "SELECT heure , id_p FROM `telepointage` WHERE `jour` LIKE '$date' AND `matricule` =".$prest['salarie_id']." AND `client_id` = ".$prest['client_id']." AND `action` LIKE 'DEBUT' and (presta_id = ".$prest['presta_id']." OR presta_id = 0) <br/>"  ;
																								    
																									$somme_hdeb_hfin =  $cmpt_heureD  + $cmpt_heureF ;  // se ligne pour savoir la somme entre h_deb et h_fin  dans me cas de resultalt 2 donc il ya le début et le fin
																									
																									// if($somme_hdeb_hfin == 2)
																									// {
																										// dbi_query("UPDATE `telepointage` SET `pointage_valider` = '1', `presta_id` = '".$prest['presta_id']."' WHERE `telepointage`.`id_p` = ".$id_pDD);
																									    // dbi_query("UPDATE `telepointage` SET `pointage_valider` = '1', `presta_id` = '".$prest['presta_id']."' WHERE `telepointage`.`id_p` = ".$id_pFF);
																									
																									// }
																									 list($presta_idDD) = dbi_fetch_row(dbi_query("SELECT presta_id FROM `telepointage` WHERE `jour` LIKE '$date' AND `matricule` =".$prest['salarie_id']." AND `client_id` = ".$prest['client_id']." AND `action` LIKE 'DEBUT'  AND `action` LIKE 'DEBUT' and (presta_id = ".$prest['presta_id']." OR presta_id = 0) ")) ;
																								     list($presta_idFF ) = dbi_fetch_row(dbi_query("SELECT presta_id FROM `telepointage` WHERE `jour` LIKE '$date' AND `matricule` =".$prest['salarie_id']." AND `client_id` = ".$prest['client_id']." AND `action` LIKE 'FIN'   AND `action` LIKE 'DEBUT' and (presta_id = ".$prest['presta_id']." OR presta_id = 0) ")) ;
                                                                                                  
																								   $q_heureD = dbi_query("SELECT heure , id_p FROM `telepointage` WHERE `jour` LIKE '$date' AND `matricule` =".$prest['salarie_id']." AND `client_id` = ".$prest['client_id']." AND `action` LIKE 'DEBUT'  ") ;
																								   $q_heureF = dbi_query("SELECT heure , id_p FROM `telepointage` WHERE `jour` LIKE '$date' AND `matricule` =".$prest['salarie_id']." AND `client_id` = ".$prest['client_id']." AND `action` LIKE 'FIN' ") ;
                                                                                                  
																								    
																								$durepointage = diff_time($heureF , $heureD)."<br/>";
																								$prestfin = int2heure(addDuree($prest['presta_Hdeb'], $prest['presta_Hduree'])).":00" ;
																								$prestdebut= int2heure($prest['presta_Hdeb']).":00" ;

																								// echo "$prestfin <==> $prestdebut <br/>" ;
																								$durepresta = diff_time($prestfin , $prestdebut);


																								// echo "===> $heureD === $heureF <br/>" ;
																								$a=0 ;
																								if($heureD != "" AND $heureF != "" )
																								{
																												$dpoint= mktime($durepointage);
																												$dpre= mktime($durepresta);


																												// if($dpre > $dpoint)
																												// {
																												// $ecart = diff_time($durepresta , $durepointage) ;
																												// $a= 1 ;
																												// }
																												// else
																												// {
																												// $ecart = diff_time($durepointage,$durepresta) ;
																												// $a=2 ;
																												// }


																												if($durepresta >= $durepointage)
																												{
																													// echo "ooo <br/>" ;
																												$ecart = diff_time($durepresta , $durepointage) ;
																												$a= 1 ;
																												}
																												else
																												{
																													// echo "mmm <br/>" ;
																												$ecart = diff_time($durepointage,$durepresta) ;
																												$a=2 ;
																												}
																								}
																								else
																								{
																									$ecart ="NULL" ;
																								}
																								// echo ""

																								// echo diff_time($int2heure(addDuree($prest['presta_Hdeb'], $prest['presta_Hduree'])), int2heure($prest['presta_Hdeb']))."<br/>";
																								++$i;
																								 echo $chaine  ;
																								 $classe="btn btn-info btn-sm";
																								 list($presta_id_sms)=dbi_fetch_row(dbi_query("SELECT presta_id FROM sms_salarie_avertissement WHERE presta_id = ".$prest["presta_id"])) ;
																							  if($presta_id_sms!=""){ $classe="btn btn-block btn-default disabled"; ;}
																							  
																							  
																							  
                                                                                               $heureD_format_int =heure2int(substr($heureD, 0, 5)) ;
																							   $heureF_format_int =heure2int(substr($heureF, 0, 5)) ; 
																							   if( ($heureF_format_int < $heureD_format_int) AND ($heureF_format_int  > 0 AND $heureD_format_int > 0 )  ){
																								 ?>
																								 <tr>
																								
																								   <td> <?php echo $prest["client_nom"]." (".$prest["presta_id"]." )" ; ?> </td>
																								   <td> <?php echo int2heure($prest['presta_Hdeb']) ; ?> </td>
																								   <td> <?php echo int2heure(addDuree($prest['presta_Hdeb'], $prest['presta_Hduree'])); ?> </td>
																								   <td> <?php echo $SAL["salarie_nom"]." ".$SAL["salarie_prenom"] ; ?> </td>
																								
																								  
																								    <td> 
																									 <input type="hidden" name="presta_iddd" value="<?=$prest["presta_id"]?>">
																									 <input type="hidden" name="salarie_id" value="<?=$prest["salarie_id"]?>">
																									 <input type="hidden" name="client_id" value="<?=$prest["client_id"]?>">
																									 
																									<?php echo $heureD ; ?> 
																									</td>
																								    <td> 
																									 <?php  echo $heureF   ;  ?> 
																									</td>
																												  <TD align="center">
																									  <?php 
																									  // $test = 7815 ; 
																									  // $testo = 7820 ; 
																									  echo '<a class="btn btn-info btn-sm" href="#myModal"  id="custId" data-toggle="modal" data-debut="'.$id_pDD.'"    data-fin="'.$id_pFF.'">   <i class="fas fa-pencil-alt"></i> </a>';
																									  ?>   
																												  </TD>
																									
                                                                                                
																						
                       																						   
																								</tr>
																								<?
																							   }
																							}

																						}

																					}
																				// }
																}

															// echo $client_nom."  --- ".$tel['heure']." --- ".$tel['action'];










																// }
															?>






															</tbody>
														</table><!-- /.table -->
													</div><!-- /.box-body -->
												</div><!-- /.tab -->
											</div><!-- /.header_ray -->
										</div><!-- /.onglet_dotted -->
								    </div><!-- /.card-body -->
							    </div><!-- /.card card-primary card-outline -->
							</div> <!-- /.col-12 -->
						</div>  <!-- /.row -->
				</section> <!-- /.section -->




	</div>




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


<script>

        function insertdata(inid, element){

            $.ajax({
                url:"without_reloading.php",
                type:"GET",
                data:{
                    "inid":inid
                },
                success:function(data){
                    element.removeAttr('onclick');
                }
            });

        }
        function change(elements){
            elements.style.backgroundColor="brown";
            elements.style.color="white";
        }

</script>


<script type="text/javascript">
$(document).ready(function(){
    $('#myModal').on('show.bs.modal', function (e) {
        var rowid = $(e.relatedTarget).data('debut');
		var indice = $(e.relatedTarget).data('fin');
		// var data = 'param1='+param1+'&param2='+param2;
		
        $.ajax({
            type : 'post',
            url : 'inverser_pointage.php', //Here you will fetch records 
            data :  'id_debut='+rowid+'&id_fin='+indice, //Pass $id
            success : function(data){
            $('#fetch').html(data);//Show fetched data from database
            }
        });
     });
});

    
</script>



</body>
</html>

AnonSec - 2021