<?php
		
	require_once('global/rmail/Rmail.php');
	
	// Daten in DB aktualisieren
	if(isset($_POST['submit'])) {
		$message = array();
		
		if(!cleanInput($_POST['vorname'])) $message[] = "Bitte geben Sie Ihren Vornamen ein.";
		if(!cleanInput($_POST['nachname'])) $message[] = "Bitte geben Sie Ihren Nachnamen ein.";
		if(!cleanInput($_POST['email'])) $message[] = "Bitte geben Sie Ihre E-Mail-Adresse ein.";
		if(!cleanInput($_POST['nachricht'])) $message[] = "Bitte geben Sie Ihre Nachricht ein.";
		
		/*
			Mail versenden
		*/
		if(!count($message)) {
			//Template einlesen
			$txtFile = "mail.txt";
			$file = @fopen($txtFile, "r");
			$size_of_file = @filesize($txtFile);
			$buffer = @fread($file, $size_of_file);
			@fclose($file);
			
			// Platzhalter im Template ersetzen
			$buffer = str_replace("#vorname#", cleanInput($_POST['vorname']), $buffer);
			$buffer = str_replace("#nachname#", cleanInput($_POST['nachname']), $buffer);
			$buffer = str_replace("#email#", cleanInput($_POST['email']), $buffer);
			$buffer = str_replace("#telefon#", cleanInput($_POST['telefon']), $buffer);
			$buffer = str_replace("#nachricht#", cleanInput($_POST['nachricht']), $buffer);
			
			// Versand
			$mail = new Rmail();
			$mail->setFrom(cleanInput($_POST['vorname']) . " " . cleanInput($_POST['nachname']) . " <" . cleanInput($_POST['email']) . ">");
			//$mail->setBcc("webmaster@media-mirror.de,ingo@exxile.net");
			$mail->setSubject("Kontaktformular auf www.diezwei-gmbh.de");
			$mail->setTextCharset('utf-8');
			$mail->setText($buffer);
      $success  = $mail->send(array("info@diezwei-gmbh.de"));
		}
	}
	
	function cleanInput($input) {
		return trim(strip_tags($input));
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/index.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<!-- InstanceBeginEditable name="doctitle" -->
<title>Die Zwei GmbH</title>
<!-- InstanceEndEditable -->

<link href="global/styles.css" type="text/css" rel="stylesheet" />
<!--[if lte IE 7]>
<link href="global/ie.css" type="text/css" rel="stylesheet" />
<![endif]-->

<link href="global/colorbox/colorbox.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="global/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="global/colorbox/jquery.colorbox-min.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
		$("a[rel='images']").colorbox();
	});
</script>

<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<!-- InstanceParam name="Start" type="text" value="" -->
<!-- InstanceParam name="Metalldach" type="text" value="" -->
<!-- InstanceParam name="Bäder" type="text" value="" -->
<!-- InstanceParam name="Haustechnik" type="text" value="" -->
<!-- InstanceParam name="Energieeffizienz" type="text" value="" -->
<!-- InstanceParam name="Photovoltaik" type="text" value="" -->
<!-- InstanceParam name="Historie" type="text" value="" -->
<!-- InstanceParam name="Kontakt" type="text" value="active" -->
<!-- InstanceParam name="Impressum" type="text" value="" -->
<!-- InstanceParam name="BODY" type="text" value="start" -->
</head>

<body class="start" id="">
<div id="header_bg_inner">&nbsp;</div>
<div id="header_bg">&nbsp;</div>
<div id="header">
  <div id="wrapper"><a href="index.htm" id="logo"><img src="global/images/logo.png" alt="Die Zwei GmbH" width="242" height="65" border="0" /></a>
    <ul id="nav_second" class="nav">
      <li class=""><a href="historie.htm">Historie</a></li>
      <li class="active"><a href="kontakt.php">Kontakt</a></li>
      <li class=""><a href="impressum.htm">Impressum</a></li>
    </ul>
    <ul id="nav" class="nav">
      <li class=""><a href="index.htm">Start</a></li>
      <li class=""><a href="metalldach.htm">Metalldach</a></li>
      <li class=""><a href="baeder.htm">Bäder</a></li>
      <li class=""><a href="haustechnik.htm">Haustechnik</a></li>
      <li class=""><a href="energieeffizienz.htm">Energieeffizienz</a></li>
      <li class=""><a href="photovoltaik.htm">Photovoltaik</a></li>
    </ul>
  </div>
</div>
<div id="container">
  <div id="content"><p class="copyright"><!-- InstanceBeginEditable name="Copyright" --><!-- InstanceEndEditable --></p>
    <h2><!-- InstanceBeginEditable name="Überschrift" -->Kontakt<!-- InstanceEndEditable --></h2>
    <!-- InstanceBeginEditable name="Inhalt" -->
    <p><strong>Nehmen SIe Kontakt mit uns auf!</strong></p>
    <p>Die Zwei GmbH<br />
      An der Jägerbäk 10<br />
      18069 Rostock</p>
    <p>Tel.: 0381 80719-0<br />
      E-Mail: <a href="mailto:diezwei.gmbh@gmx.de">diezwei.gmbh@gmx.de</a></p>
</div>
</body>
</html>
