Пример #1
0
		ENVOI
----------------------------------------------------------------------*/

$reception_form = CConfiguration::get_valeur('RECEPT_FORM_AUTO', 'non');
$reception_mail = CConfiguration::get_valeur('RECEPT_MAIL_AUTO', 'non');

if($reception_mail == 'oui') {
	if(!CMail::send_mail($destinataire, $sujet, CNmail::build_html_body('p { margin: 15px;}', $message), $expediteur)) {
		$msginfo = $msgerreur;
	} else {
		$msginfo = $msgconfirm;
	}
}
if($reception_form == 'oui'){
	$sql = "INSERT INTO email(id, nom, text, exp_nom, exp_prenom, expediteur, destinataire, date, imap) VALUES ";
	$sql.= "(null, '". CFunction::force_encode(addslashes($sujet)) . "', '" . CNmail::build_html_body('p { margin: 15px;}',addslashes($message)) . "', '". CFunction::force_encode(addslashes($nom)) . "', '". CFunction::force_encode(addslashes($prenom)) . "', '". $expediteur . "', '". $destinataire . "', '". date('Y-m-d H:i:s') . "', '')";
	
	//echo $sql;
	
	if(CBdd::insert($sql)) {
		$msginfo = $msgconfirm;		
		
		/**/
		
		if($iduser = CBdd::select_one("SELECT id FROM user WHERE email = '" . $expediteur . "'", "id")) {
			/*$sql = "UPDATE user SET nom = '" 
			. htmlentities(addslashes($nom),ENT_COMPAT ,'UTF-8') . "', prenom = '"
			. htmlentities(addslashes($prenom),ENT_COMPAT ,'UTF-8') . "', ville = '', pays = '".$pays."', telephone = '' WHERE email = '" 
			. htmlentities(addslashes($expediteur),ENT_COMPAT ,'UTF-8') . "'";
			
			CBdd::update($sql);*/