Fehler mit der session_start();

Hier werden Probleme rund um das Zahlen Captcha behandelt

Moderator: frameguard

Fehlermeldung,

Beitragvon posty_hh » 03.01.2007, 04:38

Hallo,
habe auch beim Einbau in meinen Formmailer ein kleines Prob.
Ich bekomme folgende Fehlermeldung:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /var/www/vhosts/nightlife-deutschland.de/httpdocs/mailtest.php:3) in /var/www/vhosts/nightlife-deutschland.de/httpdocs/mailtest.php on line 4

Mein Code:

Code: Alles auswählen
<?php
session_start();
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);
}
$sicherheits_eingabe = encrypt($_POST["sicherheitscode"], "8h384ls94");
$sicherheits_eingabe = str_replace("=", "", $sicherheits_eingabe);
if($sicherheits_eingabe == $_SESSION['captcha_spam']){
unset($_SESSION['captcha_spam']);


if (!isset($_POST['senden']))
{
echo '
<center>
<font size="6" color="#ffff00"><b>Location Melder:</b> </font>

<form method="post" action="">


<hr>
<font size="4" color="#FFFF00"><u>
!!!Deine Daten!!! </u> </font>
<table id="table1">
   <tr>
      <td class="td1_nav_rechts" width="110">
<font color="#eeeeee">
Dein Name:</font></td>
      <td class="td1_nav_rechts" width="150">
<font color="#eeeeee"> <input type="text" name="name"></td>
   </tr>
   <tr>
      <td class="td1_nav_rechts" width="110">
<font color="#eeeeee">Deine E-Mail Adresse: </td>
      <td class="td1_nav_rechts" width="150">
<font color="#eeeeee"> <input type="text" name="email"></td>
   </tr>
</table>
<hr>
<font size="4" color="#FFFF00"><u>
!!!Daten der Location!!! </u> </font>
<table>
   <tr>
      <td class="td1_nav_rechts">
<font color="#eeeeee">Location Name: </td>
      <td class="td1_nav_rechts" width="0">
<font color="#eeeeee"> <input type="text" name="locationname" size="40"></td>
   </tr>
   <tr>
      <td class="td1_nav_rechts">
<font color="#eeeeee">Strasse - Nr.:</td>
      <td class="td1_nav_rechts">
<font color="#eeeeee"> <input type="text" name="strasse" size="40"></td>
   </tr>
   <tr>
      <td class="td1_nav_rechts">
<font color="#eeeeee">PLZ / Stadt: </td>
      <td class="td1_nav_rechts">
<font color="#eeeeee"> <input type="text" name="stadt" size="40"></td>
   </tr>
   <tr>
      <td class="td1_nav_rechts">
<font color="#eeeeee">Homepage: </td>
      <td class="td1_nav_rechts">
<font color="#eeeeee"> <input type="text" name="url" size="40"></td>
<td class="td1_nav_rechts">
<font color="#eeeeee"><img src="/captcha/captcha.php" border="0" title="Sicherheitscode"> <input type="text" name="sicherheitscode" size="4"> </td>

   </tr>
   <tr>
      <td class="td1_nav_rechts"><font color="#eeeeee">Genre: </td>
      <td class="td1_nav_rechts"><select size="1" name="genre">
      
      <option>Anderes</option>
       <option>Billard und Dart Cafes</option>
      <option>Discos Und Co.</option>
      <option>Jugendherbergen, Jugendhäuser</option>
      <option>Kneipen, Cafés und Bars</option>
      <option>Restaurants und Co.</option>
      <option>Tattoo und Piercing Studios</option>
      
      </select></td>
   </tr>
</table><br>
<table class="navbox_rechts" id="table3" width="400">
   <tr>
      <td class="td1_nav_rechts">
<p align="center">
<font color="#eeeeee">Location Beschreibung:</td>
   </tr>
   <tr>
      <td class="td1_nav_rechts">
<font color="#eeeeee">
<textarea name="locationbeschreibung" cols="47" rows="7"></textarea></td>
   </tr>
</table>
<font size="4" color="#ffffff">
Ja Ich möcht eine Kopie der eMail </font><input type="checkbox" name="kopie" CHECKED><br>
<input type="submit" name="senden" value="Senden">
<br><br>
<font size="4" color="#ff0000">!!!Bitte ALLE Felder ausfüllen!!!</font><br>
Homepage kann ggf. frei bleiben.

</form>
</center>
';
}
else
{
$_POST['email'] = htmlentities($_POST['email']);
$_POST['locationname'] = htmlentities($_POST['locationname']);
$_POST['strasse'] = htmlentities($_POST['strasse']);
$_POST['stadt'] = htmlentities($_POST['stadt']);
$_POST['url'] = htmlentities($_POST['url']);
$_POST['genre'] = htmlentities($_POST['genre']);
$_POST['locationbeschreibung'] = htmlentities($_POST['locationbeschreibung']);
$error=false;
if (empty ($_POST['email']))
{
$error=true;
}
if (empty ($_POST['name']))
{
$error=true;
}
if (empty ($_POST['locationname']))
{
$error=true;
}
if (empty ($_POST['strasse']))
{
$error=true;
}
if (empty ($_POST['stadt']))
{
$error=true;
}
if (empty ($_POST['genre']))
{
$error=true;
}
if (empty ($_POST['locationbeschreibung']))
{
$error=true;
}
if (!$error)
{
$subject = "Danke für das senden der neuen Location";
$email = "Nightlife-International Kontakt Formular <mail@test.de>";
$email_to_cc = "$_POST[email]";
$message = "Name: $_POST[name]\n
e-Mail: $_POST[email]\n
IP: $_SERVER[REMOTE_ADDR]\n
Location Name: $_POST[locationname]\n
Strasse - Hausnummer: $_POST[strasse]\n
PLZ - Stadt: $_POST[stadt]\n
Homepage: $_POST[url]\n
Genre: $_POST[genre]\n
Location Beschreibung: $_POST[locationbeschreibung]";

mail($email,$subject,$message,"From: $_POST[email]");
if ($_POST['kopie'] == "on")
{
mail($email_to_cc,$subject,$message,"From: $email");
}
echo '<font color="ffff00">Danke, Deine Nachricht wurde gesendet.</font>';
}
else
{
echo '<center><font color="#eeeeee"><b>Pflichtfelder wurden nicht komplett ausgefüllt!</b></font></center>';
}
}
}
?>


Über ein wenig Unterstützung währe ich MEGA Dankbar.

LG
Posty
posty_hh
 
Beiträge: 2
Registriert: 03.01.2007, 04:31

Beitragvon Rob [Admin] » 03.01.2007, 11:26

Habe die Datei angepasst. Sie gibt so wie sie hier ist, bei mir keine Fehlermeldung.


Code: Alles auswählen
<?php
session_start();
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);
}

if (!isset($_POST['senden']))
{
echo '
<center>
<font size="6" color="#ffff00"><b>Location Melder:</b> </font>

<form method="post" action="">


<hr>
<font size="4" color="#FFFF00"><u>
!!!Deine Daten!!! </u> </font>
<table id="table1">
   <tr>
      <td class="td1_nav_rechts" width="110">
<font color="#eeeeee">
Dein Name:</font></td>
      <td class="td1_nav_rechts" width="150">
<font color="#eeeeee"> <input type="text" name="name"></td>
   </tr>
   <tr>
      <td class="td1_nav_rechts" width="110">
<font color="#eeeeee">Deine E-Mail Adresse: </td>
      <td class="td1_nav_rechts" width="150">
<font color="#eeeeee"> <input type="text" name="email"></td>
   </tr>
</table>
<hr>
<font size="4" color="#FFFF00"><u>
!!!Daten der Location!!! </u> </font>
<table>
   <tr>
      <td class="td1_nav_rechts">
<font color="#eeeeee">Location Name: </td>
      <td class="td1_nav_rechts" width="0">
<font color="#eeeeee"> <input type="text" name="locationname" size="40"></td>
   </tr>
   <tr>
      <td class="td1_nav_rechts">
<font color="#eeeeee">Strasse - Nr.:</td>
      <td class="td1_nav_rechts">
<font color="#eeeeee"> <input type="text" name="strasse" size="40"></td>
   </tr>
   <tr>
      <td class="td1_nav_rechts">
<font color="#eeeeee">PLZ / Stadt: </td>
      <td class="td1_nav_rechts">
<font color="#eeeeee"> <input type="text" name="stadt" size="40"></td>
   </tr>
   <tr>
      <td class="td1_nav_rechts">
<font color="#eeeeee">Homepage: </td>
      <td class="td1_nav_rechts">
<font color="#eeeeee"> <input type="text" name="url" size="40"></td>
<td class="td1_nav_rechts">
<font color="#eeeeee"><img src="/captcha/captcha.php" border="0" title="Sicherheitscode"> <input type="text" name="sicherheitscode" size="4"> </td>

   </tr>
   <tr>
      <td class="td1_nav_rechts"><font color="#eeeeee">Genre: </td>
      <td class="td1_nav_rechts"><select size="1" name="genre">
       
      <option>Anderes</option>
       <option>Billard und Dart Cafes</option>
      <option>Discos Und Co.</option>
      <option>Jugendherbergen, Jugendhäuser</option>
      <option>Kneipen, Cafés und Bars</option>
      <option>Restaurants und Co.</option>
      <option>Tattoo und Piercing Studios</option>
       
      </select></td>
   </tr>
</table><br>
<table class="navbox_rechts" id="table3" width="400">
   <tr>
      <td class="td1_nav_rechts">
<p align="center">
<font color="#eeeeee">Location Beschreibung:</td>
   </tr>
   <tr>
      <td class="td1_nav_rechts">
<font color="#eeeeee">
<textarea name="locationbeschreibung" cols="47" rows="7"></textarea></td>
   </tr>
</table>
<font size="4" color="#ffffff">
Ja Ich möcht eine Kopie der eMail </font><input type="checkbox" name="kopie" CHECKED><br>
<input type="submit" name="senden" value="Senden">
<br><br>
<font size="4" color="#ff0000">!!!Bitte ALLE Felder ausfüllen!!!</font><br>
Homepage kann ggf. frei bleiben.

</form>
</center>
';
}
else
{
$_POST['email'] = htmlentities($_POST['email']);
$_POST['locationname'] = htmlentities($_POST['locationname']);
$_POST['strasse'] = htmlentities($_POST['strasse']);
$_POST['stadt'] = htmlentities($_POST['stadt']);
$_POST['url'] = htmlentities($_POST['url']);
$_POST['genre'] = htmlentities($_POST['genre']);
$_POST['locationbeschreibung'] = htmlentities($_POST['locationbeschreibung']);
$error=false;
if (empty ($_POST['email']))
{
$error=true;
}
if (empty ($_POST['name']))
{
$error=true;
}
if (empty ($_POST['locationname']))
{
$error=true;
}
if (empty ($_POST['strasse']))
{
$error=true;
}
if (empty ($_POST['stadt']))
{
$error=true;
}
if (empty ($_POST['genre']))
{
$error=true;
}
$sicherheits_eingabe = encrypt($_POST["sicherheitscode"], "8h384ls94");
$sicherheits_eingabe = str_replace("=", "", $sicherheits_eingabe);
if($sicherheits_eingabe != $_SESSION['captcha_spam']){
unset($_SESSION['captcha_spam']);
$error=true;
}
if (empty ($_POST['locationbeschreibung']))
{
$error=true;
}
if (!$error)
{
$subject = "Danke für das senden der neuen Location";
$email = "Nightlife-International Kontakt Formular <mail@test.de>";
$email_to_cc = "$_POST[email]";
$message = "Name: $_POST[name]\n
e-Mail: $_POST[email]\n
IP: $_SERVER[REMOTE_ADDR]\n
Location Name: $_POST[locationname]\n
Strasse - Hausnummer: $_POST[strasse]\n
PLZ - Stadt: $_POST[stadt]\n
Homepage: $_POST[url]\n
Genre: $_POST[genre]\n
Location Beschreibung: $_POST[locationbeschreibung]";

mail($email,$subject,$message,"From: $_POST[email]");
if ($_POST['kopie'] == "on")
{
mail($email_to_cc,$subject,$message,"From: $email");
}
echo '<font color="ffff00">Danke, Deine Nachricht wurde gesendet.</font>';
}
else
{
echo '<center><font color="#eeeeee"><b>Pflichtfelder wurden nicht komplett ausgefüllt!</b></font></center>';
}

?>
Rob [Admin]
Site Admin
 
Beiträge: 143
Registriert: 23.12.2006, 12:27

DANKE!

Beitragvon posty_hh » 03.01.2007, 12:36

Klappt prima, vielen Dank für den SUPER Support!
Habe euch auch gleich verlinkt auf meiner Seite.

LG
Kai
Aus technischen Gründen befindet sich die Signatur auf der Rückseite des Posts!
Nightlife-Deutschland.com :D
posty_hh
 
Beiträge: 2
Registriert: 03.01.2007, 04:31

Beitragvon Rob [Admin] » 03.01.2007, 12:41

Kein Problem, vielen Dank für den Link.
Rob [Admin]
Site Admin
 
Beiträge: 143
Registriert: 23.12.2006, 12:27


Zurück zu Zahlen Captcha

Wer ist online?

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

cron