Estoy intentando que un formulario me mande una copia oculta como administrador al enviar el formulario al usuario indicado pero no hay manera... Os dejo el código a ver si me podeis hechar una manita o dar un poco de luz al tema:
Código:
<?php require_once "include/include.php"; require_once "classes/mails.php"; require_once "classes/mail_settings.php"; require_once "classes/mail_templates.php"; global $db; global $lng; $info=''; $smarty = new Smarty; $smarty = common($smarty); $smarty->assign("lng",$lng); // fix for nyromodal not considering the correct charset global $appearance_settings; header('Content-type: text/html; charset='.$appearance_settings['charset']); if(isset($_GET['ad_id']) && is_numeric($_GET['ad_id'])) $ad_id=$_GET['ad_id']; else if(isset($_POST['ContactSeller']) && $_POST['ad_id'] && is_numeric($_POST['ad_id'])) $ad_id = $_POST['ad_id']; else exit(0); $nologin = 0; if(isset($_GET['id']) && is_numeric($_GET['id']) && $_GET['id']) { $id=$_GET['id']; } else if(isset($_POST['ContactSeller']) && $_POST['id'] && is_numeric($_POST['id'])) { $id = $_POST['id']; } else { $id=0; $listings = new listings; $nologin = $listings->isNologinAd($ad_id); if(!$nologin) exit(0); } $adss = new ads_settings; $ads_settings = $adss->getAll(); $show_send_mail=$ads_settings["show_send_mail"]; if($show_send_mail==0) exit(0); $tmp=array(); $error=''; if(!$nologin) { $users=new users(); $username=$users->getUsername($id); } else { $listings = new listings; $user_info = $listings->getOwnerInfo($ad_id); $username = $user_info['mgm_name']; } if(isset($_POST['Submit']) || isset($_POST['nyroModal']) || isset($_POST['ContactSeller'])) { $mail_settings=new mail_settings(); if(!isset($_POST['name']) || $_POST['name']=='') { $error.=$lng['contact']['error']['name_missing'].'<br />'; } if(!isset($_POST['email']) || $_POST['email']=='' ) { $error.=$lng['contact']['error']['email_missing'].'<br />'; } else if(!validator::valid_email($_POST['email'])) { $error.=$lng['contact']['error']['invalid_email'].'<br />'; } if(!isset($_POST['comments']) || $_POST['comments']=='' ) { $error.=$lng['contact']['error']['comments_missing'].'<br />'; } if($settings['contact_captcha'] && (!isset($_POST['number']) || md5($_POST['number']) != $_SESSION['image_value']) ) { $error.=$lng['contact']['error']['invalid_validation_number'].'<br />'; } if($error=='') { if(!$nologin) { $useremail=$users->getEmail($id); $name=$users->getContactName($id); } else { //$listings = new listings; //$user_info = $listings->getOwnerInfo($ad_id); $useremail = $user_info['mgm_email']; $name = $user_info['mgm_name']; } $mail = new mails($useremail, $name, clean($_POST['email']), clean($_POST['name'])); $templates=new mail_templates(); $mail_array=$templates->getVal("mailto"); global $config_live_site; $mail_settings_cl=new mail_settings(); $mails_settings=$mail_settings_cl->getAll(); $html_mails=$mails_settings["html_mails"]; $ad_title = listings::getTitle($ad_id); $url_title = _urlencode($ad_title); global $seo_settings; if($seo_settings['enable_mod_rewrite']) { $lnk=$config_live_site."/".$ad_id."-".$url_title."/details.html"; } else $lnk=$config_live_site.'/details.php?id='.$ad_id; if($html_mails) $lnk = '<a href="'.$lnk.'">'.$lnk.'</a>'; // -------- create mail content ----------- $smarty_mail = new Smarty; $smarty_mail = smartyShowDBVal($smarty_mail); $smarty_mail->assign("value", $mail_array['content']); if(!$nologin) $smarty_mail->assign("username", $username); else $smarty_mail->assign("username", $name); $smarty_mail->assign("sender_name", clean($_POST['name'])); $smarty_mail->assign("sender_email", clean($_POST['email'])); $smarty_mail->assign("ad_link", $lnk); $smarty_mail->assign("title", $ad_title); $smarty_mail->assign("message", nl2br(clean($_POST['comments']))); $mail_content = $smarty_mail->fetch("db_template.html"); $mail->setMessage($mail_content); $smarty_mail->assign("value", $mail_array['subject']); $mail_subject = $smarty_mail->fetch("db_template.html"); $mail->setSubject($mail_subject); if($mail->send()) $info=$lng['contact']['message_sent']; else $info=$lng['contact']['sending_message_failed']; } else { if(isset($_POST['name'])) $tmp['name'] = clean($_POST['name']); else $tmp['name']=''; if(isset($_POST['email'])) $tmp['email'] = clean($_POST['email']); else $tmp['email']=''; if(isset($_POST['comments'])) $tmp['comments'] = clean($_POST['comments']); else $tmp['comments']=''; } if(isset($_POST['ContactSeller'])) { echo $error."|".$info; exit(0); } } $smarty->assign("id",$id); $smarty->assign("ad_id",$ad_id); $smarty->assign("username",$username); $smarty->assign("tmp", $tmp); $smarty->assign("error", $error); $smarty->assign("info",$info); $db->close(); if($db->error!='') { $db_error = $db->getError(); $smarty->assign('db_error',$db_error); } $smarty->display('mailto.html'); close(); ?>
Ese es el código pero, como digo, he probado ya varias cosas y nada, no hay forma de que me mande la copia oculta.
Alguién me hecha un poco de luz al tema?
Gracias!