Verständnisproblem mit dem einbinden ins Script

Hier werden Probleme rund um das Zahlen Captcha behandelt

Moderator: frameguard

Verständnisproblem mit dem einbinden ins Script

Beitragvon Jago » 14.06.2007, 10:09

Hi!

Ich geb's ja zu: "PHP ist für mich ein Buch mit 7 Siegeln :oops: !"

Nun gut. Ich habe schön einen Ordner mit den Dateien angelegt und auf meiner HTML-Seite den entsprechenden Code für das Bild und das Eingabefeld eingefügt. So weit, so gut.

Doch nun! Der Einbau des Codes auf mein PHP-Script - ohhhhhh jeeeee !

Bei mir geht es so los:

<?php
$body="<html><head><title>Kontaktformular</title></head><body bgcolor=#DFDFFF Link=#0000FF ALink=#FF0000 VLink=#808080 >";
if ($_POST[ToMail]=="") {

echo("<html><head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
<meta name=\"generator\" content=\"Visual-Form-Maker\">
<meta name=\"keywords\" content=\"Visual Form Maker\">

<title>Kontaktformular</title>
</head>
<body bgcolor=#DFDFFF Link=#0000FF ALink=#FF0000 VLink=#808080 >

<style type=\"text/css\">


und endet:

echo("<p><font face=verdana size=2><a href=sendung.php>Zurück zum Kontaktformular</a></font>");
}

?>


Also, so wie gezeigt habe ich es gemacht - doch es funktioniert nicht. Leider! Was mache ich falsch? Habe ich da ein <?php zuviel ???

Und was ist mit der letzten Anweisung? Diese "else-Abfrage"? Wird die einfach nur so darunter gesetzt, so wie sie ist ? Was mich wundert ist, dass der Code mit einem ; endet, bevor das eigene Script kommt. Dann aber, würde eine Klammer dort enden ? Grübel, grübel.

Ich hoffe, meine Frage ist nicht zu dämlich.

Gruß
Jago
Jago
 
Beiträge: 12
Registriert: 14.06.2007, 09:14
Wohnort: 67117 Limburgerhof

Beitragvon frameguard » 25.06.2007, 16:25

Das letzte ELSE ist optional, das ist nur, falls Du statt einer leeren Seite eine Fehlermeldung ausgeben willst.

Für Deine weiteren Fragen poste bitte den vollständigen Script MIT den Einbauten, damit ich sehe, wo eventuell der Fehler liegen könnte.
frameguard
 
Beiträge: 120
Registriert: 05.03.2007, 19:19
Wohnort: Wien

Das Script anbei

Beitragvon Jago » 26.06.2007, 09:24

Hi Frameguard!

Das ist aber nett von Dir zu hören. Deshalb Hier der Code, wie Du Ihn willst:

Ich habe im Hauptverzeichnes 2. Seiten.

Die 1. mit Namen"capchaform.htm" und dies steht drinnen:


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15">
<title>Kontaktformular</title>
</head>
<body bgcolor=#B3B3FF Link=#0000FF ALink=#FF0000 VLink=#808080 >

<style type="text/css"> <!--
.PS_1{
top:339px;
width:100px;
height:30px;
border-width:1px;
font-size:8pt;
border-color:#000000;
color:#000000;
background-color:#9393FF;
border-style:solid;
font-weight:;
font-family:Arial;
cursor:pointer;
font-style:;

}
.PC_1{
top:339px;
width:100px;
height:30px;
border-width:1px;
font-size:8pt;
border-color:#808080;
color:#808080;
background-color:#9393FF;
border-style:solid;
font-weight:;
font-family:Arial;
cursor:pointer;
font-style:;

}
.TED1_1{
top:10px;
width:288px;
height:24px;
border-width:0px;
font-size:13pt;
border-color:#000000;
color:#FFFFFF;
background-color:#B3B3FF;
border-style:none;
font-weight:bold;
font-family:Tahoma;
cursor:text;
font-style:;

}
.TED2_1{
top:90px;
width:250px;
height:20px;
border-width:1px;
font-size:10pt;
border-color:#000000;
color:#0000A0;
background-color:#FFFFFF;
border-style:solid;
font-weight:;
font-family:Tahoma;
cursor:text;
font-style:;

}
.TED3_1{
top:120px;
width:250px;
height:20px;
border-width:1px;
font-size:10pt;
border-color:#000000;
color:#0000A0;
background-color:#FFFFFF;
border-style:solid;
font-weight:;
font-family:Tahoma;
cursor:text;
font-style:;

}
.TME4_1{
top:219px;
width:370px;
height:100px;
border-width:1px;
font-size:10pt;
border-color:#000000;
color:#0000A0;
background-color:#FFFFFF;
border-style:solid;
font-weight:;
font-family:Tahoma;
cursor:text;
font-style:;

}
.TTE5_1{
top:87px;
width:110px;
height:20px;
border-width:0px;
font-size:10pt;
border-color:#C0C0C0;
color:#400080;
background-color:#B3B3FF;
border-style:none;
font-weight:bold;
font-family:Tahoma;
cursor:text;
font-style:;

}
.TTE6_1{
top:119px;
width:108px;
height:18px;
border-width:0px;
font-size:10pt;
border-color:#C0C0C0;
color:#400080;
background-color:#B3B3FF;
border-style:none;
font-weight:bold;
font-family:Tahoma;
cursor:text;
font-style:;

}
.TTE7_1{
top:148px;
width:110px;
height:20px;
border-width:0px;
font-size:10pt;
border-color:#C0C0C0;
color:#400080;
background-color:#B3B3FF;
border-style:none;
font-weight:bold;
font-family:Tahoma;
cursor:text;
font-style:;

}
.TTE8_1{
top:194px;
width:108px;
height:18px;
border-width:0px;
font-size:10pt;
border-color:#C0C0C0;
color:#400080;
background-color:#B3B3FF;
border-style:none;
font-weight:bold;
font-family:Tahoma;
cursor:text;
font-style:;

}
.TED9_1{
top:150px;
width:250px;
height:20px;
border-width:1px;
font-size:10pt;
border-color:#000000;
color:#0000A0;
background-color:#FFFFFF;
border-style:solid;
font-weight:;
font-family:Tahoma;
cursor:text;
font-style:;

}
.TSE10_1{
top:60px;
width:110px;
height:24px;
border-width:0px;
font-size:10pt;
border-color:#000000;
color:#400080;
background-color:#FFFFFF;
border-style:none;
font-weight:;
font-family:Tahoma;
cursor:text;
font-style:;

}
p.captcha{
top : 400px;
left : 100px;
position : absolute;
font-size:10pt;
font-family:Tahoma;
color:#400080;

}
p.p01{
position:absolute;
z-index: 3;
top:10px;
left : 55px;
font-family : Arial, Helvetica, sans-serif;
font-size : 15px;
color : #EFEFF8;
font-weight : bold;
}
-->
</style>




<script language=javascript>
function check_form()
{
var error,i,set,str,ele,elenam,zeichen;
ele=2;
elenam='Vorname';

set='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZß 1234567890öäüÖÄÜ';
str=window.document.forms[0].elements[ele].value;

for (i=0;i<=str.length;i++)
{
zeichen=str.charAt(i);
if (set.indexOf(zeichen)==-1)
{
alert('In Element '+elenam+' bitte nur Buchstaben oder Ziffern eingeben');
return false;
i=str.length;
}
}

ele=3;
elenam='Name';

set='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZß 1234567890öäüÖÄÜ';
str=window.document.forms[0].elements[ele].value;

for (i=0;i<=str.length;i++)
{
zeichen=str.charAt(i);
if (set.indexOf(zeichen)==-1)
{
alert('In Element '+elenam+' bitte nur Buchstaben oder Ziffern eingeben');
return false;
i=str.length;
}
}

ele=4;
elenam='mail';

str=window.document.forms[0].elements[ele].value;
if (str.indexOf('@',0)==-1)
{
alert('Ungültige E-Mailadresse in Feld: '+elenam);
return false;
}
if (str.length<6)
{
alert('Ungültige E-Mailadresse in Feld: '+elenam);
return false;
}

ele=1;
elenam='Anrede';
str=window.document.forms[0].elements[ele].selectedIndex;
if (str==0)
{
alert('Bitte wählen Sie im Feld '+elenam+' einen Eintrag aus!');
return false;
}

}
</script>
<form action=captchapruef.php method=post>
<input type=hidden name=ToMail value=manfred@digitcon.de>

<p class="p01">Was m&ouml;chten Sie wissen ?</p>


<DIV ID=EL1 style="position:absolute; left:179px;top:60px;z-index:12">
<select class=TSE10_1 name=Anrede>
<option>--- Anrede ---</option>
<option>Frau</option>
<option>Herr</option>
<option>Dr.</option>
<option>Prof.</option>
<option>Prof. Dr.</option>
<option>Mrs.</option>
<option>Mr.</option>
</select>
</DIV>

<DIV ID=EL2 style="position:absolute; left:57px;top:87px;z-index:7">
<font class=TTE5_1> Vorname</font>
</DIV>
<DIV ID=EL3 style="position:absolute; left:180px;top:90px;z-index:4">
<input class=TED2_1 type=text name=Vorname value=>
</DIV>

<DIV ID=EL4 style="position:absolute; left:59px;top:119px;z-index:8">
<font class=TTE6_1> Name</font>
</DIV>
<DIV ID=EL5 style="position:absolute; left:180px;top:120px;z-index:5">
<input class=TED3_1 type=text name=Name value=>
</DIV>

<DIV ID=EL6 style="position:absolute; left:58px;top:148px;z-index:9">
<font class=TTE7_1> e-Mail</font>
</DIV>
<DIV ID=EL7 style="position:absolute; left:180px;top:150px;z-index:11">
<input class=TED9_1 type=text name=mail value=>
</DIV>

<DIV ID=EL8 style="position:absolute; left:65px;top:194px;z-index:10">
<font class=TTE8_1>Ihre Nachricht :</font>
</DIV>
<DIV ID=EL9 style="position:absolute; left:59px;top:219px;z-index:6">
<textarea class=TME4_1 name=info></textarea>
</DIV>

<DIV ID=EL10 style="position:absolute; left:59px;top:339px;z-index:1">
<input class=PS_1 type=Submit value=Senden onclick="return check_form()">
</DIV>
<DIV ID=EL11 style="position:absolute; left:169px;top:339px;z-index:2">
<input class=PC_1 type=Reset value=Reset>
</DIV>


<input type=hidden name=FormularTitel value=Kontaktformular>
</form>
<p class="captcha"><img src="captcha/captcha.php" border="0" title="Sicherheitscode">&nbsp;&nbsp;&nbsp;<input type="text" name="sicherheitscode" size="5"><br>Bitte geben Sie hier den Code ein. Danke.</p>
</body>
</html>


Das 2. Dokumen ist: "captchapruef.htm". Hier der Inhalt:

<html>
<head>
<title>Pr&uuml;fdokument</title>
</head>
<body bgcolor="#DDDDFF">
<?php
session_start();
if(isset($_SESSION['captcha_spam']) AND $_POST["sicherheitscode"] == $_SESSION['captcha_spam']){
unset($_SESSION['captcha_spam']);
}else{
die ("Der Sicherheitscode ist falsch!");
}
$message="";
foreach($_POST as $key => $value)
{

if (is_array($_POST[$key]))
{

$merk=$key;
$liste="";
foreach($_POST[$key] as $key => $value)
{
$liste="$liste\n$value";
}
$message="$message\n\n$merk\n$liste";
} else

{
if ($key == "ToMail") {$email=$value;}
if ($key == "FormularTitel") {
$titel=str_replace("#", " ", $value);
}
$message="$message\n\n$key\n$value";
}
}
mail($email,$titel,$message,"From: <$email>");
?>


Vielen Dank f&uuml;r Ihre Nachricht, wir werden uns umgehend bei Ihnen melden.
</body>
</html>




Dann habe ich einen Ordner mit dem Namen "captcha" angelegt.

Hier sind drinnen: "capcha.php", "fehler.php" und das BG-Bild "captcha1.PNG".

Das script captcha.php ist so:

<?php
session_start();
unset($_SESSION['captcha_spam']);

function randomString($len) {
srand(date("s"));
//Der String $possible enthält alle Zeichen, die verwendet werden sollen
$possible="ABCDEFGHJKLMNPRSTUVWXYZabcdefghijkmnpqrstuvwxyz23456789";
$str="";
while(strlen($str)<$len) {
$str.=substr($possible,(rand()%(strlen($possible))),1);
}
return($str);
}

$text = randomString(5); //Die Zahl bestimmt die Anzahl stellen
$_SESSION['captcha_spam'] = $text;

header('Content-type: image/png');
$img = ImageCreateFromPNG('captcha1.PNG'); //Backgroundimage
$color = ImageColorAllocate($img, 0, 0, 0); //Farbe
$ttf = $_SERVER['DOCUMENT_ROOT']."/captcha/XFILES.TTF"; //Schriftart
$ttfsize = 25; //Schriftgrösse
$angle = rand(0,5);
$t_x = rand(5,30);
$t_y = 35;
imagettftext($img, $ttfsize, $angle, $t_x, $t_y, $color, $ttf, $text);
imagepng($img);
imagedestroy($img);
?>




... und "fehler.php" ist so aufgebaut:


<?php
session_start();
echo "<h2>Infos über das Captcha</h2>";
unset($_SESSION['captcha_spam']);
$text = rand(1000,10000); //Zufallszahl

function encrypt($string, $key) {
$result = '';
for($i=0; $i<strlen($string); $i++) {
$char = substr($string, $i, 1);
$keychar = substr($key, ($i % strlen($key))-1, 1);
$char = chr(ord($char)+ord($keychar));
$result.=$char;
}
return base64_encode($result);
}

$_SESSION['captcha_spam'] = encrypt($text, "8h384ls94"); //Key
$_SESSION['captcha_spam'] = str_replace("=", "", $_SESSION['captcha_spam']);

echo "Zahlencode: ".$text."<br>";
echo "Session Captcha: ".$_SESSION['captcha_spam']."<br>";

$img = ImageCreateFromPNG('captcha.PNG'); //Backgroundimage
$color = ImageColorAllocate($img, 0, 0, 0); //Farbe
$ttf = $_SERVER['Document_Root']."/arial.ttf"; //Schriftart

echo "Schriftpfad: ".$ttf."<br>";

$ttfsize = 25; //Schriftgrösse
$angle = rand(0,5);
$t_x = rand(5,50);
$t_y = 35;
imagettftext($img, $ttfsize, $angle, $t_x, $t_y, $color, $ttf, $text);

error_reporting(E_ALL);

echo "Image (Zeichenwirrwar):<br>";
imagepng($img);
imagedestroy($img);
?>



Tja, aber es funktioniert leider nicht.
Für Deine angebotene Hilfe bin ich Dir jedoch sehr dankbar. Danke.

Gruß
Jago
Jago
 
Beiträge: 12
Registriert: 14.06.2007, 09:14
Wohnort: 67117 Limburgerhof

Beitragvon frameguard » 26.06.2007, 14:05

Im Formular solltest das

<p class="captcha"><img src="captcha/captcha.php" border="0" title="Sicherheitscode">&nbsp;&nbsp;&nbsp;<input type="text" name="sicherheitscode" size="5"><br>Bitte geben Sie hier den Code ein. Danke.</p>

VOR </form> setzen, weil es ja noch zum Formular gehört. Sonst wird die Eingabe nicht an den Auswertungs-Script übergeben.

Die captchapruef.htm solltest umbenennen in captchapruef.php - wenn das nicht nur ein Tippfehler hier ist. ;)

Diese sollte unbedingt mit <? session_start(); ?> beginnen, noch vor den HTML-Headern, also so:

<?php
session_start();
?>
<html>
<head>
<title>Pr&uuml;fdokument</title>
</head>
<body bgcolor="#DDDDFF">
<?
if(isset($_SESSION['captcha_spam']) AND $_POST["sicherheitscode"] == $_SESSION['captcha_spam']){
unset($_SESSION['captcha_spam']);
}else{
die ("Der Sicherheitscode ist falsch!");
}

Sonst sollte das passen.

Die captcha.php und die fehler.php sind, soweit ich sehe, fehlerfrei.
frameguard
 
Beiträge: 120
Registriert: 05.03.2007, 19:19
Wohnort: Wien

Beitragvon Jago » 27.06.2007, 07:22

Hallöle frameguard!

Herzlichen Dank - doch leider ...!

Habe nun die Dokumente entsprechend geändert. Dennoch funktioniert es leider immer noch nicht. Das "htm" war natürlich ein blöder Tippfehler. Es ist ein PHP-Dokument. :roll:

Beim Test habe ich folgende Meldung erhalten:

Parse error: parse error, unexpected '<' in /var/www/produktion/1758/www.naturheilpraxis-doll.de/htdocs/captchapruef.php on line 11

Doch in Zeile 11 habe ich gar nichts! Grübel?!

Hier nochmal die geänderten Scripte:

1.) captchaform.htm:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15">
<meta name="generator" content="Visual-Form-Maker">
<meta name="keywords" content="Visual Form Maker">
<title>Kontaktformular</title>
</head>
<body style="background-color: #B3B3FF;">

<style type="text/css"> <!--
.PS_1{
top:339px;
width:100px;
height:30px;
border-width:1px;
font-size:8pt;
border-color:#000000;
color:#000000;
background-color:#9393FF;
border-style:solid;
font-weight:;
font-family:Arial;
cursor:pointer;
font-style:;

}
.PC_1{
top:339px;
width:100px;
height:30px;
border-width:1px;
font-size:8pt;
border-color:#808080;
color:#808080;
background-color:#9393FF;
border-style:solid;
font-weight:;
font-family:Arial;
cursor:pointer;
font-style:;

}
.TED1_1{
top:10px;
width:288px;
height:24px;
border-width:0px;
font-size:13pt;
border-color:#000000;
color:#FFFFFF;
background-color:#B3B3FF;
border-style:none;
font-weight:bold;
font-family:Tahoma;
cursor:text;
font-style:;

}
.TED2_1{
top:90px;
width:250px;
height:20px;
border-width:1px;
font-size:10pt;
border-color:#000000;
color:#0000A0;
background-color:#FFFFFF;
border-style:solid;
font-weight:;
font-family:Tahoma;
cursor:text;
font-style:;

}
.TED3_1{
top:120px;
width:250px;
height:20px;
border-width:1px;
font-size:10pt;
border-color:#000000;
color:#0000A0;
background-color:#FFFFFF;
border-style:solid;
font-weight:;
font-family:Tahoma;
cursor:text;
font-style:;

}
.TME4_1{
top:219px;
width:370px;
height:100px;
border-width:1px;
font-size:10pt;
border-color:#000000;
color:#0000A0;
background-color:#FFFFFF;
border-style:solid;
font-weight:;
font-family:Tahoma;
cursor:text;
font-style:;

}
.TTE5_1{
top:87px;
width:110px;
height:20px;
border-width:0px;
font-size:10pt;
border-color:#C0C0C0;
color:#400080;
background-color:#B3B3FF;
border-style:none;
font-weight:bold;
font-family:Tahoma;
cursor:text;
font-style:;

}
.TTE6_1{
top:119px;
width:108px;
height:18px;
border-width:0px;
font-size:10pt;
border-color:#C0C0C0;
color:#400080;
background-color:#B3B3FF;
border-style:none;
font-weight:bold;
font-family:Tahoma;
cursor:text;
font-style:;

}
.TTE7_1{
top:148px;
width:110px;
height:20px;
border-width:0px;
font-size:10pt;
border-color:#C0C0C0;
color:#400080;
background-color:#B3B3FF;
border-style:none;
font-weight:bold;
font-family:Tahoma;
cursor:text;
font-style:;

}
.TTE8_1{
top:194px;
width:108px;
height:18px;
border-width:0px;
font-size:10pt;
border-color:#C0C0C0;
color:#400080;
background-color:#B3B3FF;
border-style:none;
font-weight:bold;
font-family:Tahoma;
cursor:text;
font-style:;

}
.TED9_1{
top:150px;
width:250px;
height:20px;
border-width:1px;
font-size:10pt;
border-color:#000000;
color:#0000A0;
background-color:#FFFFFF;
border-style:solid;
font-weight:;
font-family:Tahoma;
cursor:text;
font-style:;

}
.TSE10_1{
top:60px;
width:110px;
height:24px;
border-width:0px;
font-size:10pt;
border-color:#000000;
color:#400080;
background-color:#FFFFFF;
border-style:none;
font-weight:;
font-family:Tahoma;
cursor:text;
font-style:;

}
p.captcha{
top : 400px;
left : 100px;
position : absolute;
font-size:10pt;
font-family:Tahoma;
color:#400080;

}
p.p01{
position:absolute;
z-index: 3;
top:10px;
left : 55px;
font-family : Arial, Helvetica, sans-serif;
font-size : 15px;
color : #EFEFF8;
font-weight : bold;
}
-->
</style>




<script language=javascript>
function check_form()
{
var error,i,set,str,ele,elenam,zeichen;
ele=2;
elenam='Vorname';

set='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZß 1234567890öäüÖÄÜ';
str=window.document.forms[0].elements[ele].value;

for (i=0;i<=str.length;i++)
{
zeichen=str.charAt(i);
if (set.indexOf(zeichen)==-1)
{
alert('In Element '+elenam+' bitte nur Buchstaben oder Ziffern eingeben');
return false;
i=str.length;
}
}

ele=3;
elenam='Name';

set='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZß 1234567890öäüÖÄÜ';
str=window.document.forms[0].elements[ele].value;

for (i=0;i<=str.length;i++)
{
zeichen=str.charAt(i);
if (set.indexOf(zeichen)==-1)
{
alert('In Element '+elenam+' bitte nur Buchstaben oder Ziffern eingeben');
return false;
i=str.length;
}
}

ele=4;
elenam='mail';

str=window.document.forms[0].elements[ele].value;
if (str.indexOf('@',0)==-1)
{
alert('Ungültige E-Mailadresse in Feld: '+elenam);
return false;
}
if (str.length<6)
{
alert('Ungültige E-Mailadresse in Feld: '+elenam);
return false;
}

ele=1;
elenam='Anrede';
str=window.document.forms[0].elements[ele].selectedIndex;
if (str==0)
{
alert('Bitte wählen Sie im Feld '+elenam+' einen Eintrag aus!');
return false;
}

}
</script>
<form action=captchapruef.php method=post>
<input type=hidden name=ToMail value=manfred@digitcon.de>

<p class="p01">Was m&ouml;chten Sie wissen ?</p>


<DIV ID=EL1 style="position:absolute; left:179px;top:60px;z-index:12">
<select class=TSE10_1 name=Anrede>
<option>--- Anrede ---</option>
<option>Frau</option>
<option>Herr</option>
<option>Dr.</option>
<option>Prof.</option>
<option>Prof. Dr.</option>
<option>Mrs.</option>
<option>Mr.</option>
</select>
</DIV>

<DIV ID=EL2 style="position:absolute; left:57px;top:87px;z-index:7">
<font class=TTE5_1> Vorname</font>
</DIV>
<DIV ID=EL3 style="position:absolute; left:180px;top:90px;z-index:4">
<input class=TED2_1 type=text name=Vorname value=>
</DIV>

<DIV ID=EL4 style="position:absolute; left:59px;top:119px;z-index:8">
<font class=TTE6_1> Name</font>
</DIV>
<DIV ID=EL5 style="position:absolute; left:180px;top:120px;z-index:5">
<input class=TED3_1 type=text name=Name value=>
</DIV>

<DIV ID=EL6 style="position:absolute; left:58px;top:148px;z-index:9">
<font class=TTE7_1> e-Mail</font>
</DIV>
<DIV ID=EL7 style="position:absolute; left:180px;top:150px;z-index:11">
<input class=TED9_1 type=text name=mail value=>
</DIV>

<DIV ID=EL8 style="position:absolute; left:65px;top:194px;z-index:10">
<font class=TTE8_1>Ihre Nachricht :</font>
</DIV>
<DIV ID=EL9 style="position:absolute; left:59px;top:219px;z-index:6">
<textarea class=TME4_1 name=info></textarea>
</DIV>

<DIV ID=EL10 style="position:absolute; left:59px;top:339px;z-index:1">
<input class=PS_1 type=Submit value=Senden onclick="return check_form()">
</DIV>
<DIV ID=EL11 style="position:absolute; left:169px;top:339px;z-index:2">
<input class=PC_1 type=Reset value=Reset>
</DIV>
<input type=hidden name=FormularTitel value=Kontaktformular>
<p class="captcha"><img src="captcha/captcha.php" border="0" title="Sicherheitscode">&nbsp;&nbsp;&nbsp;<input type="text" name="sicherheitscode" size="5"><br>Bitte geben Sie hier den Code ein. Danke.</p>
</form>
</body>
</html>



2.) captchapruef.php:


<?php
session_start();
?>
<html>
<head>
<title>Pr&uuml;fdokument</title>
</head>
<body bgcolor="#DDDDFF">
<?php
session_start();
<?
if(isset($_SESSION['captcha_spam']) AND $_POST["sicherheitscode"] == $_SESSION['captcha_spam']){
unset($_SESSION['captcha_spam']);
}else{
die ("Der Sicherheitscode ist falsch!");
}

$message="";
foreach($_POST as $key => $value)
{

if (is_array($_POST[$key]))
{

$merk=$key;
$liste="";
foreach($_POST[$key] as $key => $value)
{
$liste="$liste\n$value";
}
$message="$message\n\n$merk\n$liste";
} else

{
if ($key == "ToMail") {$email=$value;}
if ($key == "FormularTitel") {
$titel=str_replace("#", " ", $value);
}
$message="$message\n\n$key\n$value";
}
}
mail($email,$titel,$message,"From: <$email>");
?>


Vielen Dank f&uuml;r Ihre Nachricht, wir werden uns umgehend bei Ihnen melden.
</body>
</html>


Wenn Du Dir das noch einmal ansehen magst?

Gruß
Jago
Jago
 
Beiträge: 12
Registriert: 14.06.2007, 09:14
Wohnort: 67117 Limburgerhof

Beitragvon frameguard » 27.06.2007, 17:13

Der Fehler verbirgt sich in der captchapruef.php (siehe auch die Fehlermeldung). Und zwar hast Du da:

<?php
session_start();
?>
<html>
<head>
<title>Pr&uuml;fdokument</title>
</head>
<body bgcolor="#DDDDFF">
<?php
session_start();
<?
if(isset($_SESSION['captcha_spam']) AND $_POST["sicherheitscode"] == $_SESSION['captcha_spam']){
usw. usw.

Da ist in Zeile 11 also ein <?, dann gleich noch ein session_start();, und dann gleich wieder <? - kein Wunder gibt der Server eine Fehlermeldung aus.

So ist's richtig:

<?php
session_start();
?>
<html>
<head>
<title>Pr&uuml;fdokument</title>
</head>
<body bgcolor="#DDDDFF">
<?
if(isset($_SESSION['captcha_spam']) AND $_POST["sicherheitscode"] == $_SESSION['captcha_spam']){
usw. usw.
frameguard
 
Beiträge: 120
Registriert: 05.03.2007, 19:19
Wohnort: Wien

Beitragvon Jago » 28.06.2007, 06:43

Hi frameguard!

Hab ich nun so gemacht. Funzt aber leider immer noch nicht. Jaul! :cry:

Jetzt bekomme ich diese Fehlermeldung, mit der ich leider nichts anfangen kann:

Warning: session_start(): open(/var/www/produktion/1758/www.naturheilpraxis-doll.de/temp//sess_113c2bfd7b7533f66bb6128eacca423b, O_RDWR) failed: Permission denied (13) in /var/www/produktion/1758/www.naturheilpraxis-doll.de/htdocs/captchapruef.php on line 2

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /var/www/produktion/1758/www.naturheilpraxis-doll.de/htdocs/captchapruef.php:2) in /var/www/produktion/1758/www.naturheilpraxis-doll.de/htdocs/captchapruef.php on line 2

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /var/www/produktion/1758/www.naturheilpraxis-doll.de/htdocs/captchapruef.php:2) in /var/www/produktion/1758/www.naturheilpraxis-doll.de/htdocs/captchapruef.php on line 2
Der Sicherheitscode ist falsch!
Warning: Unknown(): open(/var/www/produktion/1758/www.naturheilpraxis-doll.de/temp//sess_113c2bfd7b7533f66bb6128eacca423b, O_RDWR) failed: Permission denied (13) in Unknown on line 0

Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/www/produktion/1758/www.naturheilpraxis-doll.de/temp/) in Unknown on line 0


Das Script sieht nun so aus:


<?php
session_start();
?>
<html>
<head>
<title>Pr&uuml;fdokument</title>
</head>
<body bgcolor="#DDDDFF">
<?
if(isset($_SESSION['captcha_spam']) AND $_POST["sicherheitscode"] == $_SESSION['captcha_spam']){

unset($_SESSION['captcha_spam']);
}else{
die ("Der Sicherheitscode ist falsch!");
}

$message="";
foreach($_POST as $key => $value)
{

if (is_array($_POST[$key]))
{

$merk=$key;
$liste="";
foreach($_POST[$key] as $key => $value)
{
$liste="$liste\n$value";
}
$message="$message\n\n$merk\n$liste";
} else

{
if ($key == "ToMail") {$email=$value;}
if ($key == "FormularTitel") {
$titel=str_replace("#", " ", $value);
}
$message="$message\n\n$key\n$value";
}
}
mail($email,$titel,$message,"From: <$email>");
?>

Vielen Dank f&uuml;r Ihre Nachricht, wir werden uns umgehend bei Ihnen melden.
</body>
</html>



Ob wir es noch hin bekommen ?
Das wäre zu schön!

Grußi
Jago
Jago
 
Beiträge: 12
Registriert: 14.06.2007, 09:14
Wohnort: 67117 Limburgerhof

Beitragvon Steef389 » 28.06.2007, 07:54

Überprüfe mal, ob vor dem ersten <?php irgendwelche Leerzeichen oder Leerzeilen sind.
Wenn ja, entferne sie mal, und schau obs geht.
Steef389
 
Beiträge: 57
Registriert: 20.06.2007, 20:31

Beitragvon Jago » 28.06.2007, 11:23

Hi Steef389!

Nein, es geht direkt in Zeile1/Zeichen1 los mit: " <?php ".


Gruß
Jago
Jago
 
Beiträge: 12
Registriert: 14.06.2007, 09:14
Wohnort: 67117 Limburgerhof

Beitragvon frameguard » 28.06.2007, 12:50

Mir gefällt die Fehlermeldung
Warning: session_start(): open(/var/www/produktion/1758/www.naturheilpraxis-doll.de/temp//sess_113c2bfd7b7533f66bb6128eacca423b, O_RDWR) failed: Permission denied (13) in /var/www/produktion/1758/www.naturheilpraxis-doll.de/htdocs/captchapruef.php on line 2

nicht.

Ich fürchte, das hat nichts mehr mit dem Script zu tun, sondern mit den Serverrechten. :(
frameguard
 
Beiträge: 120
Registriert: 05.03.2007, 19:19
Wohnort: Wien

Beitragvon Jago » 28.06.2007, 13:45

Hi frameguard!

Danke für Deine Nachricht und die Mühe, die Du - aber auch die Anderen - sich gemacht haben.

Tja, wenn mein englisch doch nur besser wäre :oops: !

Aber, nun habe ich mich mit dem Provider in Verbindung gesetzt. Hoffe mal, dass ich nun weiter komme.

Dennoch, vielen, vielen Dank !!! :D

Grußikowski
Manfred
Jago
 
Beiträge: 12
Registriert: 14.06.2007, 09:14
Wohnort: 67117 Limburgerhof

Beitragvon frameguard » 28.06.2007, 13:50

Gern geschehen, ich drück die Daumen! :)
frameguard
 
Beiträge: 120
Registriert: 05.03.2007, 19:19
Wohnort: Wien

Beitragvon Steef389 » 28.06.2007, 20:17

Ich wünsch dir auch viel glück
Steef389
 
Beiträge: 57
Registriert: 20.06.2007, 20:31

Beitragvon Jago » 29.06.2007, 06:38

Hi frameguard,
guten Morgen Steef389!

Also, aus "Performancegründen" sollte ich mein HTML-Dokument in ein PHP-Script ändern, wie mir der Provider mitteilte. Das habe ich gemacht und siehe da, es funzt fast. Aber, leider nur fast!

Ich bekomme korrekte Fehlermeldungen, wie z.B. e-Mail-Anschrift nicht O.K. u.s.w..

Nur, das Captcha-Bild mit der Codevorgabe, die ist leider immer noch nicht zu sehen. So sehr ich micht auch bemühe. Den Fehler finde ich einfach nicht.

Könnt Ihr nochmals einen Blick ( oder zwei ) darauf werfen ?
( Die Scripte sind unverändert, wie die letzten bereits gezeigt. )

Danke
Manfred
Jago
 
Beiträge: 12
Registriert: 14.06.2007, 09:14
Wohnort: 67117 Limburgerhof

Beitragvon Steef389 » 29.06.2007, 07:35

So, habe jetzt die Skripte mal auf meinen Webspace hochgeladen und es funktioniert.
Ich lasse es noch ein Weilchen oben, damit du dich davon überzeugen kannst.
Ich habe nur die E-Mail senden funktion ausgebaut, damit du keine 1000 E-Mails kriegst.
Link: http://steef389.st.funpic.de/form.html

Schau mal ob der Pfad zu deinem Captcha passt. (v. a. Groß- und Kleinschreibung) oder ruf die captcha.php mal direkt auf, ob du das Bild siehst oder eine Fehlermeldung.
Steef389
 
Beiträge: 57
Registriert: 20.06.2007, 20:31

Nächste

Zurück zu Zahlen Captcha

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 0 Gäste

cron