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/TMCPRO/pages/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/logmcpe/www/TMCPRO/pages/stable_functions_tmcpro.php
<?php
define ('TABLE_ABSENCES', 'absence');
define ('TABLE_AGENCE', 'agence') ;
define ('TABLE_ALERTE', 'alerte') ;
define ('TABLE_AVOIR', 'avoir') ;
define ('TABLE_AUTRES', 'autres') ;
define ('TABLE_CAUSES', 'cause_absence') ;
define ('TABLE_CANDI', 'candidature') ;
define ('TABLE_CLES', 'cles') ;
define ('TABLE_CLIC', 'auto');
define ('TABLE_CONJ', 'conjoint');
define ('TABLE_BURO', 'bureau');
define ('TABLE_LOGE', 'logement');
define ('TABLE_INTERDI', 'interdiction');
define ('TABLE_CLIENT', 'client') ;
define ('TABLE_CLIENT_SUIVI', 'client_suivi') ;
define ('TABLE_SUIVI_BIAIS', 'suivi_biais') ;
define ('TABLE_SUIVI', 'suivi') ;
define ('TABLE_COMP', 'complement') ;
define ('TABLE_CONFIG', 'config') ;
define ('TABLE_CONFLIT', 'conflit') ;
define ('TABLE_CONTRAT', 'contrat') ;
define ('TABLE_DISPO', 'disponibilite') ;
define ('TABLE_DEM', 'demande') ;
define ('TABLE_SUIVIC', 'suvi_client');
define ('TABLE_EXCEPT', 'exception') ;
define ('TABLE_FACT', 'facture') ;
define ('TABLE_FACT_TEMP', 'facture_temp') ;
define ('TABLE_FORFAITS', 'forfait');
define ('TABLE_INTERV', 'intervenant') ;
define ('TABLE_RELANC', 'relance') ;
define ('TABLE_MESS', 'message') ;
define ('TABLE_OFFRE', 'offre') ;
define ('TABLE_PAIEMENT', 'paiement') ;
define ('TABLE_PART', 'partenaire') ;
define ('TABLE_PREST', 'prestation') ;
define ('TABLE_PRESTA_MODIF', 'presta_modif') ;
define ('TABLE_PROSPE', 'prospect') ;
define ('TABLE_PLNG', 'planning') ;
define ('TABLE_PUB', 'pub') ;
define ('TABLE_REGLEMENT', 'reglement') ;
define ('TABLE_STATUS_P', 'prospect_status') ;
define ('TABLE_STATUS_C', 'candi_status') ;
define ('TABLE_SMIC', 'smic') ;
define ('TABLE_USER', 'users') ;
define ('TABLE_VILLE', 'ville') ;
define ('TABLE_TACHES', 'taches') ;
define ('TABLE_PROJETS', 'projets') ;
// define ('TABLE_INTERDI', 'interdiction') ;
 

define ('MALADIE', '1') ;
define ('PERSO', '2') ;
define ('FERIE', '3') ;
define ('PERSONNE', '') ;


function calcul_duree($dureD ,$dureF)
{
$h_fin = substr($dureF, 0, 2); 				   
$m_fin = substr($dureF, -2);	
$h_deb = substr($dureD, 0, 2); 				   
$m_deb = substr($dureD, -2);	


    if ( ! isset ( $h_fin ) ) {
        $presta_Hduree = 0;
    } else {
      $endmins = ( 60 * (int) ( $h_fin ) ) + $m_fin;
      $startmins = ( 60 * $h_deb ) + $m_deb;
      $presta_Hduree = $endmins - $startmins;
    }
    if ( $presta_Hduree < 0 ) {
        $presta_Hduree = 0;
    } 
  return $presta_Hduree ; 

}
	
	function heure2int($heurs)
	{
		  $h2 = substr($heurs, -2);
          $h1 = substr($heurs, 0, 2); 
          $h=$h1."".$h2."00" ; 
		  return $h ; 
	}
	
	
	function mois_to_nbr($chaine)
{
	switch ($chaine) {
	case "Janvier":
        $mois = "01" ; 
        break;
    case "Février":
        $mois = "02" ; 
        break;
    case "Mars":
        $mois = "03" ; 
        break;
    case "Avril":
        $mois = "04" ; 
        break;
    case "Mai":
        $mois = "05" ; 
        break;
    case "Juin":
        $mois = "06" ; 
        break;
    case "Juillet":
        $mois = "07" ; 
        break;
    case "Août":
        $mois = "08" ; 
        break;
    case "Septembre":
        $mois = "09" ; 
        break;
    case "Octobre":
        $mois = "10" ; 
        break;
    case "Novembre":
        $mois = "11" ; 
        break;
    case "Décembre":
        $mois = "12" ; 
        break;

}

return $mois ; 
	
}


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

			 // exit();
			 
			 // echo "==>".$_SESSION['MCPRO']['user_id'] ; 
			 
			 // profilclient9.php
			 
			 $path = $_SERVER['PHP_SELF']; // $path = /home/httpd/html/index.php
			 
			 // echo "==>".$path."<br/>" ; 
			 
$file = basename ($path);
// echo"$file"; // index.php
			 $where_etab =  "" ;
			 
			 
		$calendar2_9 = "" ; 
// list($user_statut)= dbi_fetch_row(dbi_query("SELECT user_statut FROM `users` WHERE `user_id` =  ".$_SESSION['MCPRO']['user_id'])); 
   // if($user_statut==3){
	   // for($i=0 ; $i<300000 ; $i++){}
	   // if(!empty($_POST))
	   // {
		   // echo "<h3>";
		   // exit() ; 
	   // }
   
   // if($file == "profilclient9.php" or $file == "Prestation_New9.php"){
				 
				   // for($i=0 ; $i<3000000000 ; $i++){}
			 // }
   
   // if($_SESSION['MCPRO']['user_id'] == 111)  
			 // {
			 // $where_etab = " AND c.etablissement_id = 1  ";
			 // $calendar2_9 = " AND salarie_id = 3210" ;
			 // $_sal_calendar2_9 =  3210; 
			 // }
			 
			    

			  // if($_SESSION['MCPRO']['user_id'] == 110) 
			 // {
			 // $where_etab = " AND  ( c.etablissement_id = 2 OR c.etablissement_id = 3 )"  ;
			  // $calendar2_9 = " AND salarie_id = 3205" ; 
			   // $_sal_calendar2_9 =  3205; 
			  
			 // }
			 
			 // }
   
function int2date ($int, $format = 'd/m/Y')
{
	static $corresp = array(array('d','m','Y','M','l', 'D', 'F'), array('%d','%m','%Y','%M','%l', '%D', '%F'), array('%d', '%m', '%Y', '%b', '%A', '%a', '%B')) ;
	if (!$int)
		return '';
	///setlocale(LC_TIME, array('fr_fr', 'fr_FR', 'fr', 'FR'));
	// if (ereg("WIN", PHP_OS)) setlocale (LC_TIME, "french");
	// else if (ereg("BSD", PHP_OS)) setlocale (LC_TIME, "fr_FR.ISO8859-1");
	// else setlocale (LC_TIME, "fr_FR");
	$date = strftime(str_replace($corresp[1], $corresp[2], preg_replace('/([^\\\\]|^)(['.join('', $corresp[0]).'%])/', '\1%\2', $format)), int2time($int)) ;
	return $date ;
}

function addDuree ($heure, $duree)
{
	sscanf(sprintf('%06d', $heure), '%02d%02d%02d', $h, $m, $s) ;
	$m += $duree ;
	while($m >= 60)
	{
		$m -= 60 ;
		$h ++ ;
	}
	return sprintf('%02d%02d%02d', $h, $m, $s) ;
}
function int2time ($int)
{
	return mktime(0,0,0,substr($int, 4, 2),substr($int,6,2),substr($int,0,4));
}
function time2int ($time)
{
	return date('Ymd', $time) ;
}
function date2int ($yass)
{
	
	$jour = substr($yass,0,2);
$mois = substr($yass,3,2);
$annee = substr($yass,6,4);
	
	return date('Ymd', mktime(0,0,0,$mois, $jour, $annee)) ;
}


function dateformaint ($yass)
{
	
	$jour = substr($yass,8,2);
$mois = substr($yass,5,2);
$annee = substr($yass,0,4);
	
	return date('Ymd', mktime(0,0,0,$mois, $jour, $annee)) ;
}


function int2date_autre_format ($yass , $format = 'Y-m-d')
{
	// echo " rr $yass <br/>" ; 
	$jour = substr($yass,6,2);
	// echo "==> rr jours $jour <br/>" ; 
$mois = substr($yass,4,2);
// echo "==> rr mois $mois <br/>" ; 
$annee = substr($yass,0,4);
// echo "==> rr annee $annee <br/>" ; 
	return date($format, mktime(0,0,0,$mois, $jour, $annee)) ;
}

function int2date_autre_format_deux ($yass , $format = 'm/d/Y')
{
	// echo " rr $yass <br/>" ; 
	$jour = substr($yass,6,2);
	// echo "==> rr jours $jour <br/>" ; 
$mois = substr($yass,4,2);
// echo "==> rr mois $mois <br/>" ; 
$annee = substr($yass,0,4);
// echo "==> rr annee $annee <br/>" ; 
	return date($format, mktime(0,0,0,$mois, $jour, $annee)) ;
}

function date2int_DSI ($yass)
{
	// 2021-04-06
	// echo " rr $yass <br/>" ; 
	$jour = substr($yass,8,2);
	// echo "==> rr jours $jour <br/>" ; 
$mois = substr($yass,5,2);
// echo "==> rr mois $mois <br/>" ; 
$annee = substr($yass,0,4);
// echo "==> rr annee $annee <br/>" ; 
	return $annee."".$mois."".$jour ;
	
	
	// date($format, mktime(0,0,0,$mois, $jour, $annee)) ;
}




function date_forma_int_plus_deux_ans ($yass)
{
	
	$jour = substr($yass,8,2);
$mois = substr($yass,5,2);
$annee = substr($yass,0,4);
	$annee = $annee + 2 ; 
	return date('Ymd', mktime(0,0,0,$mois, $jour, $annee)) ;
}





			 
			 $path = $_SERVER['PHP_SELF']; // $path = /home/httpd/html/index.php
			 
			 // echo "==>".$path."<br/>" ; 
			 
$file = basename ($path);
// echo"$file"; // index.php
			 $where_etab =  "" ;
			 
			 
		$calendar2_9 = "" ; 
list($user_statut)= dbi_fetch_row(dbi_query("SELECT user_statut FROM `users` WHERE `user_id` =  ".$_SESSION['MCPRO']['user_id'])); 
   if($user_statut==3){
	   for($i=0 ; $i<300000 ; $i++){}
	  

        if($file == "index9.php" OR  $file == "jaxModifierLiv_info.php" OR $file == "jaxModifierLiv.php" OR $file == "demliv9.php" OR   $file == "fcinstruction9.php"  OR   $file == "Produits_livree9.php"   OR   $file == "nvprospect9.php"     ){
			
		}
	  elseif(($_GET['sup_tache_pospect']== 1) OR ($_POST['modifier_prospect']== "modifier_prospect") OR (!empty($_POST['document_nom'])) OR  $file == "ajaxAjoutDocument.php"  )
	   {
		   echo "<h3>";
		   exit() ; 
	   }
	   
	   
	      if( $file == "salarie_emploi.php" OR  $file == "recap_instructions.php"  ){
				 
				   for($i=0 ; $i<15000000000 ; $i++){}
			 }
   
   if($file == "Prestation_New9.php" OR $file == "salarie_emploi.php"){
				 
				   for($i=0 ; $i<3000000000 ; $i++){}
			 }
   
   if($_SESSION['MCPRO']['user_id'] == 111)  //OUDJAIL Sofian
			 {
			 $where_etab = " AND c.etablissement_id = 1  ";
			 $calendar2_9 = " AND salarie_id = 3210" ; // la page  calendar2_9.php
			 $_sal_calendar2_9 =  3210; 
			 }
			 
			    

			  if($_SESSION['MCPRO']['user_id'] == 110)  // BAUTZMANN Lionel
			 {
			 $where_etab = " AND  ( c.etablissement_id = 2 OR c.etablissement_id = 3 )"  ;
			  $calendar2_9 = " AND salarie_id = 3205" ; // la page  calendar2_9.php
			   $_sal_calendar2_9 =  3205; 
			  
			 }
			 
			 }
   



function dateMCPROint_calendar ($yass)
{
	
	$jour = substr($yass,8,2);
	// echo "jj ==> $jour <br/>" ; 
$mois = substr($yass,5,2);
	// echo "mm ==> $mois <br/>" ; 
$annee = substr($yass,0,4);
	// echo "aa ==> $annee <br/>" ; 
	
	return date('Ymd', mktime(0,0,0,$mois, $jour, $annee)) ;
}

function dateMCPROint ($yass)
{
	
	$jour = substr($yass,0,2);
	// echo "j ==> $jour <br/>" ; 
$mois = substr($yass,3,2);
	// echo "m ==> $mois <br/>" ; 
$annee = substr($yass,6,4);
	// echo "a ==> $annee <br/>" ; 
	
	return date('Ymd', mktime(0,0,0,$mois, $jour, $annee)) ;
}

function int2heure($int, $format = 'H\:i')
{
	sscanf(sprintf('%06d', $int), '%02d%02d%02d', $h, $m, $s) ;
	return date($format, 24*3600+$h*3600 + $m*60 + $s - 3600) ;
}


function add_day($time, $day=1)
{
	$time += $day*24*3600 ;
	if(date('H', $time) == 23)
		$time += 3600 ;
	if(date('H', $time) == 1)
		$time -= 3600 ;
	return $time ;
}

function payerFacture ($fId, $montant, $mode, $cId, $cheque=NULL, $bank=NULL,$datep=NULL)
{
// echo $datep.' ++++ ';
// exit() ; 
	// $datep = date('Ymd');
	global $agence ;
	list($client_id, $fId) = dbi_fetch_row(dbi_query("select client_id, num_fact FROM ".TABLE_FACT." Where fact_id = $fId"));
	if(!$client_id) $client_id=$cId;
	if(empty( $client_id))
		 $client_id=0;
	$montant = str_replace(',', '.', $montant) ;
	$cpt=0;
	dbi_query("INSERT INTO reglementt (montant, reglement_id, date, `client_id` , num_cheque, banque ) VALUES ($montant, $mode, $datep, $client_id".($cheque!=NULL ? ", '$cheque'" : ", NULL")." ".($bank!=NULL ? ", '$bank'": ", NULL" ).")" );
     	 list($reg) = dbi_fetch_row(dbi_query("SELECT max(reg_id) FROM reglementt")) ;
		 
	while($fId != 0 && $montant > 0.001 && $cpt<100)
	{ 
		$cpt++;
		$q = dbi_fetch_row(dbi_query("SELECT f.fact_id, total-if(p.montant is null, 0, p.montant)-if(a.montant is null, 0, a.montant) AS paye FROM ".TABLE_FACT." f
LEFT JOIN (select if(sum(if(montant is null, 0, montant)) is null, 0, sum(if(montant is null, 0, montant))) montant, fact_id
	FROM ".TABLE_PAIEMENT." where client_id = $client_id and agence_id = $agence group by fact_id) p using (fact_id)
LEFT JOIN (select if(sum(if(montant is null, 0, montant)) is null, 0, sum(if(montant is null, 0, montant))) montant, fact_id
	FROM ".TABLE_AVOIR." where agence_id = $agence group by fact_id) a using (fact_id)
WHERE f.client_id=$client_id AND f.agence_id=$agence AND num_fact = $fId GROUP BY f.fact_id, total")) ;

		if($q['paye']) { 
			dbi_query("INSERT INTO ".TABLE_PAIEMENT." (montant, reglement_id, fact_id, date, agence_id, client_id, num_cheque, banque,reg_id ) VALUES (".min($montant, $q['paye']).", $mode, ".$q['fact_id'].", $datep, $agence, $client_id".($cheque!=NULL ? ", '$cheque'" : ", NULL")." ".($bank!=NULL ? ", '$bank'": ", NULL" ).",$reg)" );
		}
			
		$montant = round(($montant-$q['paye']),2);
		//$montant -= $q['paye'] ;
		
		list($fId) = dbi_fetch_row(dbi_query("SELECT MIN(num_fact) FROM ".TABLE_FACT." f
LEFT JOIN (select if(sum(if(montant is null, 0, montant)) is null, 0, sum(if(montant is null, 0, montant))) montant, fact_id
	FROM ".TABLE_PAIEMENT." where client_id = $client_id and agence_id = $agence group by fact_id) p using (fact_id)
LEFT JOIN (select if(sum(if(montant is null, 0, montant)) is null, 0, sum(if(montant is null, 0, montant))) montant, fact_id
	FROM ".TABLE_AVOIR." where agence_id = $agence group by fact_id) a using (fact_id)
 WHERE f.client_id=$client_id AND f.agence_id=$agence and total-if(p.montant is null, 0, p.montant)-if(a.montant is null, 0, a.montant) > 0.001")) ;
	}
	if($montant > 0.001) {
		dbi_query("INSERT INTO ".TABLE_PAIEMENT." (montant, reglement_id, fact_id, date, agence_id, client_id, num_cheque, banque,reg_id) VALUES ('".$montant."', '".$mode."', 0, '".$datep."',  '".$agence."', '".$client_id."'".($cheque!=NULL ? ", '$cheque'" : ", NULL")." ".($bank!=NULL ? ", '$bank'": ", NULL" ).", $reg)") ;
	}
}

?>

AnonSec - 2021