<?php
//  Copyright (c) 2004-2006 randshop
//  http://www.randshop.com
//
//  Unter Lizenz von randshop
//	
//	Letzte Bearbeitung: 03.07.2006


	session_start();
	
	// Hauptkonfigurationsdatei
	include_once("../../conf/config.inc.php");
	include_once(DATEIPFAD."conf/db.inc.php");
	include_once(DATEIPFAD . "includes/shopinitialize.inc.php");
	if(KUNDENGRUPPEN) {
		include_once(DATEIPFAD . "includes/functions.mod.kundengruppen.inc.php");
	} else {
		include_once(DATEIPFAD . "includes/functions.kundengruppen.inc.php");
	}
	include_once(DATEIPFAD . "includes/functions.global.inc.php");
	include_once(DATEIPFAD . "includes/functions.artikel.inc.php");
	include_once(DATEIPFAD . "includes/functions.kategorie.inc.php");
	//Sessionregister
	include_once(DATEIPFAD . "includes/session_register.inc.php");
	include_once(DATEIPFAD . "includes/global_off.inc.php");
	
	// Spracheninclude
	if (@fopen(DATEIPFAD . "includes/language/langu_" . $_SESSION["languageisocode"] . ".inc.php",r)) {
		include_once(DATEIPFAD . "includes/language/langu_" . $_SESSION["languageisocode"] . ".inc.php");
	} else {
		include_once(DATEIPFAD . "includes/language/langu_de.inc.php");
	}		

if($katId == "") {
	$_SESSION['kat'] = "";
}


	// Header
	include_once(DATEIPFAD . "includes/header.inc.php");
	

if(!$_POST["formAction"]) {
	$contentFile = DATEIPFAD . "templates/" . $rowTemp->name . "/website/weiterempfehlen/form.tpl";
}

if($_POST["formAction"] == "abschicken") {
	if(($_POST["vorname"] !="") && ($_POST["nachname"] !="") && ($_POST["e_mail"] !="") && ($_POST["vornameAbs"] !="") && ($_POST["nachnameAbs"] !="") && ($_POST["e_mailAbs"] !="")) {
		$str_weiterMail = sprintf($str_weiterMail, $_POST["vorname"], $_POST["nachname"], $_POST["vornameAbs"], $_POST["nachnameAbs"], $_POST["vornameAbs"], $_POST["nachnameAbs"], $_POST["gruesse"]);
		
		$mailEmpf = $str_weiterMail . $tpl_firmname . "\n\n" . URLPFAD;
		if (FALSE !== strpos($_POST["e_mail"], "\r") || FALSE !== strpos($_POST["e_mail"], "\n")) {
			echo "Spammer";
		} else {
			mail($_POST["e_mail"],$mailBetreffEmpfehlung,$mailEmpf, "From: ".$_POST["e_mailAbs"]."\n" . "Reply-To: ". $_POST["e_mailAbs"] . "\nContent-Type: text/plain; charset=".CHARSET);
		}
		$contentFile = DATEIPFAD . "templates/" . $rowTemp->name . "/website/weiterempfehlen/erfolgreich.tpl";
	} else {
		$tpl_empffehler = $str_empffehler;
		$classe = 'id="formFehler"';
		$contentFile = DATEIPFAD . "templates/" . $rowTemp->name . "/website/weiterempfehlen/form.tpl";
	}
}


// Letzte globale Zusammenfassung z.B. fuer Warenkorbanzeige, bevor das Template geladen wird.
include_once(DATEIPFAD . "includes/footer.inc.php");


// Template	
include_once(DATEIPFAD . "templates/" . $rowTemp->name . "/website/index.tpl");

@mysql_close($db);
?>
