Eigenes Kontaktformular verwenden
Posted: Sun Jul 04, 2010 1:41 pm
Hallo,
ich würde gerne ein eigenes Kontaktformular auf ner CMSms-Seite verwenden, bekommen aber immer nur Fehlermeldungen:
Folgendes hab ich im Template ganz am Anfang stehen:
Dann kommt das ganz normale Template und an der Stelle wo sonst {content} ist, habe ich halt den Code für's Kontaktformular eingefügt:
Die Fehlermeldung sieht dann so aus:
(hab sie einfach mal komplett eingefügt, ich weis nicht, was da mehr relevant ist und was weniger)
Was kann ich jetzt machen, damit es funktioniert? Wenn ich es einfach so als PHP-Datei auf den Webspace hochlade funktioniert's.
Liegt es vielleicht an den Pretty-Urls und der damit verbundenen Endung .html ?
ich würde gerne ein eigenes Kontaktformular auf ner CMSms-Seite verwenden, bekommen aber immer nur Fehlermeldungen:
Folgendes hab ich im Template ganz am Anfang stehen:
Code: Select all
<?php
$versendet = 'FALSE';
$vollstaendig = "";
if (isset($_POST["Senden"]) &&
$_POST["Senden"] == "Abschicken") {
if (!isset($_POST["Absender"]) ||
!is_string($_POST["Absender"]) ||
trim($_POST["Absender"]) == "") {
$vollstaendig .= "<li>Ihr Name fehlt</li>";
}
if (!isset($_POST["Email"]) ||
!is_string($_POST["Email"]) ||
trim($_POST["Email"]) == "" ||
!preg_match("#(.+)@(.+)\.[a-z]{2,}#", $_POST["Email"])) {
$vollstaendig .= "<li>Die Emailadresse fehlt oder ist ungültig</li>";
}
[etc]
function verboten($test_string)
{
$verboten = array("content-type:",
"mime-version:",
"multipart/mixed",
"content-transfer-encoding:",
"bcc:",
"cc:",
"to:");
$ertappt = "";
foreach($verboten as $verboten)
{
if(eregi($verboten, strtolower($test_string)))
{
$ertappt .= "<li>Der Text ist aus Sicherheitsgründen ungültig, da "".$verboten."" verwendet wurde.</li>";
}
}
return $ertappt;
}
function neue_zeile($test_string)
{
$erwischt = '';
if(preg_match("/(%0A|%0D|\\n+|\\r+)/i", $test_string) != 0)
{
$erwischt = '<li>Aus Sicherheitsgründen ist der Betreff, dein Name oder deine Email-Adresse ungültig, da diese(r) mehrzeilig ist.</li>';
}
return $erwischt;
}
$vollstaendig .= verboten($_POST['Absender']);
$vollstaendig .= verboten($_POST['Email']);
$vollstaendig .= verboten($_POST['Betreff']);
$vollstaendig .= verboten($_POST['Nachricht']);
$vollstaendig .= neue_zeile($_POST['Absender']);
$vollstaendig .= neue_zeile($_POST['Email']);
$vollstaendig .= neue_zeile($_POST['Betreff']);
}
if (isset($_POST["Senden"]) &&
$_POST["Senden"] == "Abschicken" &&
$vollstaendig == "") {
$mailtext .= "\nEs wurde eine Email über das Kontaktformular auf www.ju-segeberg.de verschickt: ";
$mailtext .= "\n\nAbsender der Mail: ";
$mailtext .= $_POST["Absender"];
$mailtext .= "\n\nBetreff: ";
$mailtext .= $_POST["Betreff"];
$mailtext .= "\n\nNachricht: ";
$mailtext .= $_POST["Nachricht"];
$mailtext .= "\n\n\n\nDer Absender hat folgende Emailadresse zum Antworten angegeben:";
$mailtext .= $_POST["Email"];
mail("email@web.de",
"Nachricht per Kontaktformular empfangen: ".$_POST["Betreff"],
"$mailtext",
"From:".$_POST["Absender"]." <".$_POST["Email"].">");
$versendet = 'TRUE';
}
?>
Code: Select all
<?php
if ($versendet == 'FALSE') {
if (!isset($_POST["Senden"]) ||
$_POST["Senden"] != "Abschicken" ||
$vollstaendig != "") {
?>
Bitte alle Felder vollständig und korrekt ausfüllen.
<?php
if (isset($_POST["Senden"]) &&
$_POST["Senden"] == "Abschicken" &&
$vollstaendig != "") {
?>
<div class="unvollst">
Achtung! Ein odere mehrere Fehler sind aufgetreten:<br />
<ul><?php print($vollstaendig); ?></ul>
</div>
<?php
}
?>
<form method="post" accept-charset="ISO-8859-1">
<table class="formulartabelle" cellpadding="0" cellspacing="0"><tr><td class="formspalte1"><input type="text" name="Absender"
value="<?php
if (isset($_POST["Absender"]) &&
is_string($_POST["Absender"])) {
print(htmlspecialchars($_POST["Absender"]));
}
?>"
class="formfeld" /></td><td class="formspalte2">Ihr Name</td></tr>
<tr><td class="formspalte1"><input type="text" name="Email"
value="<?php
if (isset($_POST["Email"]) &&
is_string($_POST["Email"])) {
print(htmlspecialchars($_POST["Email"]));
}
?>"
class="formfeld" /></td><td class="formspalte2">Ihre Emailadresse</td></tr>
[etc]
<input type="submit" name="Senden" value="Abschicken" class="formbatten" />
</form>
<?php
}
} else {
?>
Vielen Dank! Deine Email wurde soeben erfolgreich abgeschickt.<br />
<?php } ?>
Code: Select all
string(129) "Smarty error: [in tpl_top:25 line 8]: syntax error: unbalanced parenthesis in if
statement (Smarty_Compiler.class.php, line 1277)" string(125) "Smarty error: [in tpl_top:25 line 8]:
syntax error: unidentified token '["Absender"])' (Smarty_Compiler.class.php, line 1410)" string(125)
"Smarty error: [in tpl_top:25 line 8]: syntax error: unidentified token
'["Absender"])' (Smarty_Compiler.class.php, line 1410)" string(125) "Smarty error: [in tpl_top:25 line
8]: syntax error: unidentified token '["Absender"])' (Smarty_Compiler.class.php, line 1410)" string
(113) "Smarty error: [in tpl_top:25 line 8]: syntax error: unidentified token
'{' (Smarty_Compiler.class.php, line 1410)" string(114) "Smarty error: [in tpl_top:25 line 8]: syntax
error: unidentified token '.=' (Smarty_Compiler.class.php, line 1410)" string(113) "Smarty error: [in
tpl_top:25 line 8]: syntax error: unidentified token ';' (Smarty_Compiler.class.php, line 1410)" string
(111) "Smarty error: [in tpl_top:25 line 15]: syntax error: unrecognized tag: 2,
(Smarty_Compiler.class.php, line 446)" string(110) "Smarty error: [in tpl_top:25 line 15]: syntax
error: unrecognized tag '' (Smarty_Compiler.class.php, line 590)" string(126) "Smarty error: [in
tpl_top:25 line 82]: syntax error: unclosed tag \{if} (opened line 8). (Smarty_Compiler.class.php,
line 317)" string(131) "Smarty error: [in tpl_body:25 line 62]: syntax error: unbalanced parenthesis
in if statement (Smarty_Compiler.class.php, line 1277)" string(125) "Smarty error: [in tpl_body:25
line 62]: syntax error: unidentified token '["Senden"])' (Smarty_Compiler.class.php, line 1410)" string
(124) "Smarty error: [in tpl_body:25 line 62]: syntax error: unidentified token
'["Senden"]' (Smarty_Compiler.class.php, line 1410)" string(115) "Smarty error: [in tpl_body:25 line
62]: syntax error: unidentified token '{' (Smarty_Compiler.class.php, line 1410)" string(116) "Smarty
error: [in tpl_body:25 line 62]: syntax error: unidentified token '?>' (Smarty_Compiler.class.php, line
1410)" string(119) "Smarty error: [in tpl_body:25 line 62]: syntax error: unidentified token
';ndig' (Smarty_Compiler.class.php, line 1410)" string(120) "Smarty error: [in tpl_body:25 line 62]:
syntax error: unidentified token ';llen.' (Smarty_Compiler.class.php, line 1410)" string(118) "Smarty
error: [in tpl_body:25 line 62]: syntax error: unidentified token '?php' (Smarty_Compiler.class.php,
line 1410)" string(125) "Smarty error: [in tpl_body:25 line 62]: syntax error: unidentified token
'["Senden"])' (Smarty_Compiler.class.php, line 1410)" string(124) "Smarty error: [in tpl_body:25 line
62]: syntax error: unidentified token '["Senden"]' (Smarty_Compiler.class.php, line 1410)" string
(115) "Smarty error: [in tpl_body:25 line 62]: syntax error: unidentified token
'{' (Smarty_Compiler.class.php, line 1410)" string(116) "Smarty error: [in tpl_body:25 line 62]:
syntax error: unidentified token '?>' (Smarty_Compiler.class.php, line 1410)" string(115) "Smarty
error: [in tpl_body:25 line 62]: syntax error: unidentified token '=' (Smarty_Compiler.class.php, line
1410)" string(118) "Smarty error: [in tpl_body:25 line 62]: syntax error: unidentified token
':' (Smarty_Compiler.class.php, line 1410)" string(118) "Smarty error: [in tpl_body:25 line 62]:
syntax error: unidentified token '?php' (Smarty_Compiler.class.php, line 1410)" string(154) "Smarty
error: [in tpl_body:25 line 85]: syntax error: unrecognized tag: print(htmlspecialchars($_POST
["Absender"])); (Smarty_Compiler.class.php, line 446)" string(111) "Smarty error: [in tpl_body:25
line 85]: syntax error: unrecognized tag '' (Smarty_Compiler.class.php, line 590)" string(151)
"Smarty error: [in tpl_body:25 line 94]: syntax error: unrecognized tag: print(htmlspecialchars
($_POST["Email"])); (Smarty_Compiler.class.php, line 446)" string(111) "Smarty error: [in
tpl_body:25 line 94]: syntax error: unrecognized tag '' (Smarty_Compiler.class.php, line 590)" string
(154) "Smarty error: [in tpl_body:25 line 103]: syntax error: unrecognized tag: print
(htmlspecialchars($_POST["Betreff"])); (Smarty_Compiler.class.php, line 446)" string(112) "Smarty
error: [in tpl_body:25 line 103]: syntax error: unrecognized tag '' (Smarty_Compiler.class.php, line
590)" string(120) "Smarty error: [in tpl_body:25 line 115]: syntax error: unrecognized tag: ?>
Was kann ich jetzt machen, damit es funktioniert? Wenn ich es einfach so als PHP-Datei auf den Webspace hochlade funktioniert's.
Liegt es vielleicht an den Pretty-Urls und der damit verbundenen Endung .html ?