<% $DH->set_stylesheets(array('screen.css'=>'screen','email.css'=>'screen')); $DH->set_activeTopMenu('CONTACT'); $DH->set_flags(array('sv','en','fr')); $DH->set_title('Email'); $DH->set_subMenu('submenus/links.inc'); include_once ('contact.inc'); //Declares a global $email variable //Selecting the email if( (isset($_REQUEST['to']) && array_key_exists(strtolower($_REQUEST['to']),$email)) ){ $selectedID=strtolower($_REQUEST['to']); }else{ $selectedID=''; } %> <%= $DH->head(); %> <%= $DH->banner(); %> <%= $DH->topmenu(); %>
<% /*<%= $DH->submenu(); %>*/ %>
<% if(empty($selectedID)){%>

<%= dh_translate('email_to_whom');%>

$arr){ $code .= ''; $code .="\n"; } echo $code."\n"; ?>
'; $code .= ''; $code .= ''; $code .= '
'.$arr["name"].''; $code .= '
'; $code .= '
<% } else { //there is a selection echo '

'; if($_SESSION['lang']=='fr'){echo 'Email à "';} elseif($_SESSION['lang']=='en'){echo 'Email to "';} else{echo 'Email till "';} echo $email[$selectedID]['name']; echo '"


'; include_once('contact.inc'); /************************************************************\ ** Error Checking \************************************************************/ function check_errors(){ // This test prevents values being entered in a URL if ($_SERVER['REQUEST_METHOD'] != "POST"){ Err::register( __FILE__,__LINE__,'Method '.$_SERVER['REQUEST_METHOD'].' not allowed','method'); header('Location: /contact/'); exit(); } if(empty($_POST['from'])){ Err::register( __FILE__,__LINE__,dh_translate("Supply a name"),'from'); } if(empty($_POST['email'])){ Err::register( __FILE__,__LINE__,dh_translate("Supply an email address"),'email'); } else { Err::validateEmail($_POST['email']); } $text=trim(stripslashes($_POST['textmessage'])); if(empty($text)){ Err::register( __FILE__,__LINE__,dh_translate("No text"),'text'); } if(empty($_POST['number'])){ Err::register( __FILE__,__LINE__,dh_translate("Supply the image code"),'ImageValue'); } elseif(md5(strtoupper($_POST['number'])) != $_SESSION['image_value']){ Err::register( __FILE__,__LINE__,dh_translate("Wrong image code. Try again"),'ImageValue'); } return Err::hasErr(); } /************************************************************\ ** Determining the action \************************************************************/ $selected=$email[$selectedID]; // Shouldn't be empty there... if(!isset($_POST['action'])){ $action = "display"; } elseif ($_POST['action'] == 'send'){ $action =(check_errors())?"display":"send"; } /************************************************************\ ** Processing information \************************************************************/ if($action == "display"){ $thefrom = trim(stripslashes($_POST['from'])); $theemail = trim(stripslashes($_POST['email'])); $theheader = (isset($_POST['header']))?trim(stripslashes($_POST['header'])):trim(stripslashes($_GET['preheader'])); $thetextmessage = (isset($_POST['textmessage']))?trim(stripslashes($_POST['textmessage'])):trim(stripslashes($_GET['pretext'])); %>
<%= dh_translate('from');%>: <%= Err::isErr('from')?'
'.Err::getErrCauseByType('from'):''; %>
<%= dh_translate('email');%>: <%= Err::isErr('email')?'
'.Err::getErrCauseByType('email'):''; %>

<%= dh_translate('header');%>:
<%= Err::isErr('text')?Err::getErrCauseByType('text').'
':''; %>

[X] <% if($_SESSION['lang'] == 'en' ){%> To avoid spam, write in the following field what you see in the picture:
(Letters only. Click on the picture to read a new code)
<% }elseif($_SESSION['lang'] == 'fr' ){%> Pour éviter le spam, quel est le texte dans l'image suivante:
(Seulement des lettres. Cliquez sur l'image pour lire un nouveau code)
<% }else{%> För att undvika spam, vad ser du för text i bilden:
(Bara bokstäver. Klicka på bilden om du inte ser bra)
<% }%>
[password missing] =

<% }elseif($action == "send"){ $from = trim($_POST['from']); $fromEmail = trim($_POST['email']); $to = $email[$selectedID]['email']; $toName = $email[$selectedID]['name']; $subject = "[DH] ".utf8_decode(trim($_POST['header'])); //$body = str_replace("\n","
",trim(stripslashes($_POST['textmessage']))); $body = "========================\n"; $body .= "From: ".utf8_decode($from)." <".utf8_decode($fromEmail).">"; $body .= "\n========================\n"; $body .= utf8_decode(trim(stripslashes($_POST['textmessage']))); if($to == 'webmaster@dansenshus.info'){ $body .= "\n\n\n=========== EXTRA INFO =============\n"; $body .= "Remote Address: ".$_SERVER['REMOTE_ADDR']."\n"; $body .= "HTTP User Agent: ".$_SERVER['HTTP_USER_AGENT']."\n"; $body .= "ISO Date: ".date('c'); } $headers["From"] = '"'.$from.'" <'.$fromEmail.'>'; $headers["Reply-To"]= '<'.$fromEmail.'>'; $headers["X-Mailer"]= 'PHP '. phpversion(); echo '
'; echo '

'.dh_translate('thanks').', '.$from.' ['.$fromEmail.']

'; echo '

'.$toName.' '.dh_translate('is grateful for your comments').'.
'; echo '

'.dh_translate('mvh').'


'; include_once('email.inc'); if (dh_sendMail($to, $subject, $body, $headers)) { echo("

Message sent!

"); // Copy to Webmaster... if($to != 'webmaster@dansenshus.info'){ $copyToWebmaster = "========================\n"; //$copyToWebmaster .= "From: ".utf8_decode($from)." <".utf8_decode($fromEmail).">"; //$copyToWebmaster .= "\n========================\n"; $copyToWebmaster .= "Directed to: $toName <$to>"; $copyToWebmaster .= "\n========================\n"; $copyToWebmaster .= "Subject: ".$subject; $copyToWebmaster .= "\n=========== BODY =============\n"; $copyToWebmaster .= $body; $WebmasterHeaders["From"] = '"DH Webmaster" '; //$WebmasterHeaders["To"] = '"DH Webmaster" '; $WebmasterHeaders["X-Mailer"]= 'PHP '. phpversion(); dh_sendMail("webmaster@dansenshus.info", "[DH] Email Logging Tools", $copyToWebmaster,$WebmasterHeaders); } } else { echo("

Message delivery failed...

"); } echo('

Back to the homepage

'); echo '
'; } Err::resetLog(); } %>
<%= $DH->footer(); %>