Hallo alle zusammen,
ich habe ein kleines Problem. Ich habe ein PHP Location in mein Formmailer eingefügt, sodass nach einem Post auf die die "danke.php" umgeleitet wird. Wenn ich es mit dem PHP Location probiere kommt folgende Fehlermeldung:
Code:
Warning: Cannot modify header information - headers already sent by (output started at /users/maria/www/testtest (original).php:1) in /users/maria/www/testtest (original).php on line 152
Hier mein Formmailer:
Code:
<?php echo '<?xml version="1.0" encoding="iso-8859-1"?>' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Kontakt</title>
<meta http-equiv="content-script-type" content="text/javascript" />
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="robots" content="all" />
<meta name="description" lang="de" content="---" xml:lang="de" />
<meta name="description" lang="en" content="---" xml:lang="en" />
<meta name="keywords" content="---" />
<meta name="verify-v1" content="---" />
<link rel="shortcut icon" type="image/x-icon" href="./favicon.ico" />
<?php
if(stristr($_SERVER['HTTP_USER_AGENT'], 'MSIE')) echo ' <link rel="stylesheet" type="text/css" href="./template/style_default.css" />';
if(stristr($_SERVER['HTTP_USER_AGENT'], 'Firefox')) echo ' <link rel="stylesheet" type="text/css" href="./template/style_ff.css" />';
if(stristr($_SERVER['HTTP_USER_AGENT'], 'Opera')) echo ' <link rel="stylesheet" type="text/css" href="./template/style_default.css" />';
if(stristr($_SERVER['HTTP_USER_AGENT'], 'Safari')) echo ' <link rel="stylesheet" type="text/css" href="./template/style_default.css" />';
if(stristr($_SERVER['HTTP_USER_AGENT'], 'Konqueror')) echo ' <link rel="stylesheet" type="text/css" href="./template/style_default.css" />';
?>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-2477528-1";
urchinTracker();
</script>
<script type="text/javascript" src="./template/jquery.js"></script>
<script type="text/javascript" src="./template/jquery.accordion.js"></script>
<script type="text/javascript" src="./template/site_loading.js"></script>
<script type="text/javascript">
jQuery().ready(function(){
// first simple Accordion with special markup
jQuery('#nav').Accordion({
header: 'div.title',
active: false,
alwaysOpen: false,
animated: false
});
jQuery('#nav').activate(0);
});
</script>
</head>
<body onload="MM_showHideLayers('nav_menu','','show');MM_showHideLayers('nav_info','','hide')">
<? include ("./includes/header_banner.php"); ?>
<? include ("./includes/side_image.php"); ?>
<div class="table">
<table>
<tr>
<td class="header">
Kontakt
</td>
</tr>
<tr>
<td class="big_title">
Offizieller Ansprechpartner
</td>
</tr>
<tr>
<td>
---
</td>
</tr>
<tr>
<td class="entried">
<?php
if (isset($_POST['submit'])) {
$fehler = false;
$fehlertext = "";
function no_reload()
{
$gleichheit = false;
if (isset($_POST["uw"])) {
$datei = "unique.txt";
$fp = fopen($datei, "r+");
$aw = fgets($fp, 30);
if ($aw == $_POST["uw"]) {
$gleichheit = true;
}
rewind($fp);
fputs($fp, $_POST["uw"]);
fclose($fp);
}
return $gleichheit;
}
$unique = no_reload();
if (empty($_POST['Name'])) {
$fehler = true;
$fehlertext .= "Verrat uns doch bitte, wie Du heißt.<br>\n";
} elseif (strlen($_POST['Name']) < 3) {
$fehler = true;
$fehlertext .= "Dein Name ist zu kurz.<br>\n";
}
$muster = "/^[a-zA-Z0-9-_.]+@[a-zA-Z0-9-_.]+\.[a-zA-Z]{2,4}$/";
if (empty($_POST['Email'])) {
$fehler = true;
$fehlertext .= "Deine E-Mail Adresse fehlt!<br>\n";
} elseif (preg_match($muster, $_POST['Email']) == 0) {
$fehler = true;
$fehlertext .= "Es gab ein Problem! Deine E-Mail Adresse scheint ungültig zu sein.<br>\n";
}
$muster = "(www.[a-zA-Z0-9_-]+)\.([a-zA-Z0-9.]+)";
$pos = strpos($_POST['Nachricht'], "http://");
if (empty($_POST['Nachricht'])) {
$fehler = true;
$fehlertext .= "Bitte hinterlass uns eine Nachricht.<br>\n";
} elseif (strlen($_POST['Nachricht']) < 3) {
$fehler = true;
$fehlertext .= "Deine Nachricht ist zu kurz.<br>\n";
} elseif($pos === true) {
$fehler = true;
$fehlertext .= "Bitte keine URLs posten";
}
if (strlen($_POST['p_send']) >1) {
$fehler = true;
$fehlertext .= "Da deine Nachricht verdacht auf Spam enthält, wird deine E-Mail nicht versandt!";
}
if (empty($_POST['submit'])) {
{
setcookie("submit", "474174", time()+60); // 1 Minute
}
$fehler = true;
$fehlertext .= "Bitte sende nicht so viele E-Mail's, bitte warte noch eine Minute!";
}
if ($fehler) {
echo "$fehlertext";
} elseif (!$unique) { // Hier habe ich den zusätzlichen Check auf Gleichheit eingebaut
$mailbody .= "An: " .$_POST['mailto']. "\n";
$mailbody .= "Von: " .$_POST['Name']. "\n";
$mailbody .= "Absender: " .$_POST['Email']. "\n";
$mailbody .= "Homepage: " .$_POST['Homepage']. "\n";
$mailbody .= "IP: " .$_SERVER['REMOTE_ADDR'] . "\n";
$mailbody .= "Nachricht: " .$_POST['Nachricht']. "\n";
$mailbody = stripslashes($mailbody);
if (@E-Mail("contact@mydomain.de", "Neue mydomain.de Nachricht!", $mailbody, "Von: $Email")) {
header("Location: http://www.mydomain.de/contact=posted.php");
}
}
}
?>
</td>
</tr>
</table>
<form action=".<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table>
<tr>
<td class="cth-t"><label for="mailto">Email an</label></td>
<td class="cth-p">
<select id="mailto" onchange="" name="mailto" class="cth-i">
<option value="Maria">Maria</option>
<option value="Josef">Josef</option>
</select>
</td>
</tr>
<tr>
<td class="cth-t"><label for="Name">Name</label></td>
<td class="cth-p"><input class="cth-i" type="text" id="Name" name="Name" size="50" value="<?php
if (isset($_POST['Name'])) {
echo htmlspecialchars(stripslashes($_POST['Name']));
}
?>" /></td>
</tr>
<tr>
<td class="cth-t"><label for="Email">E-Mail</label></td>
<td class="cth-p"><input class="cth-i" type="text" id="E-Mail" name="Email" value="<?php
if (isset($_POST['Email'])) {
echo htmlspecialchars(stripslashes($_POST['Email']));
}
?>" /></td>
</tr>
<tr>
<td class="cth-t"><label for="Homepage">Homepage</label></td>
<td class="cth-p"><input class="cth-i" type="text" id="Homepage" name="Homepage" value="" /></td>
</tr>
<tr>
<td class="cth-t"><label for="Nachricht">Text</label></td>
<td class="cth-p">
<textarea rows="10" cols="50" id="Nachricht" name="Nachricht" class="cth-i"><?php
if (isset($_POST['Nachricht'])) {
echo stripslashes($_POST['Nachricht']);
}
?></textarea>
</td>
</tr>
<tr>
<td class="cth-t">*</td>
<td class="cth-p"><input type="submit" name="submit" value="E-Mail senden" />
<input type="hidden" name="uw" value="<?php echo time(); ?>" />
<input class="p_send" type="text" name="p_send" value="" />
</td>
</tr>
</table>
</form>
</div>
<div class="over_line"></div>
<div class="navigation">
<div class="nav_menu" id="nav_menu">
<div id="nav">
<? include ("./includes/navigation_links_nav_de.php"); ?>
</div>
</div>
</div>
<div class="flag">
<table>
<tr>
<td>
<a href="./contact,de.htm"><img src="./images/flag_de.gif" height="15" class="pic" alt="Deutsch" /></a> - <a href="./contact,en.htm"><img src="./images/flag_en.gif" height="15" class="pic" alt="English" /></a>
</td>
</tr>
</table>
</div>
<div class="valide">
<a href="http://validator.w3.org/check?uri=referer"><img src="./images/valid-xhtml10-blue.gif" height="31" width="88" alt="Valid XHTML 1.0 Strict" class="pic" /></a>
</div>
<div class="copyright">Copyright by mydomain.de 2008</div>
<div class="verwaltung"><a href="./login,de.htm" class="lhover">Verwaltung</a></div>
<div class="nav_info" id="nav_info">Seite lädt...</div>
<div class="adsense">
<? include ("./includes/adsense.php"); ?>
</div>
</body>
</html>
Ich hoffe es kann mir jemand helfen, da ich wieder mal am Verzweifeln bin, sitze schon seit heute Morgen dran und Google auch, finde aber nichts gescheites... .