Location: PHPKode > scripts > GigKalender > guestbook/guestbook_mail.php
<?php
/*
    CREATIVE COMMONS - Attribution-No Derivative Works 3.0 Germany:
    - You may not alter, transform, or build upon this work.
    - Dieses Werk darf nicht bearbeitet oder in anderer Weise verändert werden.
*/
  $Path = str_replace('\\','/', __FILE__);
  $Path = str_replace('guestbook/guestbook_mail.php', '', $Path);
  
  include_once ($Path."gigkalender.ini.php");
  include_once ("functions.php");
  include_once ($Path."functions/standard.php");
  include_once ($Path."includes/frontend_language_selector.php");
  
  if (isset($_REQUEST['http-equiv'])) $http_equiv = $_REQUEST['http-equiv'];
      else $http_equiv = '';
  $http_equiv = str_replace("&","&amp;",$http_equiv);
  $GuestbookID = $_REQUEST['id'];
  echo '<div id="GigKalender"><div class="Guestbook">';
  $messageIsSpam = messageIsSpam ($_POST['message'], $_SERVER['REMOTE_ADDR'], '', '');
  if ($messageIsSpam!='') writeSpamLog ( $_POST['name'], '', $_POST['email'], '', '', '', $_POST['message'], $_SERVER['REMOTE_ADDR'], $messageIsSpam, 'guestbook_mail' );
  $SQL = "SELECT * FROM ".$prefix."guestbook WHERE GuestbookID = '".$GuestbookID."' LIMIT 1";
  $result = mysql_query($SQL);
  while ($row = mysql_fetch_array($result))
  {
    extract($row);
    $Datum = DatumUndUhrzeitAusTimestamp ($Datum);
    $Name = $Name;
    $empfänger = $Email;
  }
  $Path = $_SERVER['HTTP_HOST'];
  $subject = $L_139.' '.$Path;
  if (isset($_POST['senden']) && isset($_POST['name']) && isset($_POST['email']) && ($_POST['message']!="") && checkEmail ($_POST['email']) && (!messageIsSpam ($_POST['message'], '', '', '' )))
  {
    $MailName = $_POST['name'];
    $MailEmail = $_POST['email'];
    $MailMessage = $_POST['message'];
    $MailMessage = $L_020." ".$Name.",\n\n".$L_140." ".$Path.".\n\n".$L_141."\n\n---\n\n".$L_022.": ".$MailName."\n\n".$L_026.": ".$MailMessage;


    // Mail mit Header definieren
      $optheader[] = "From: ".$MailName." <".$MailEmail.">";
      $optheader[] = "Content-Type: text/plain; Charset=utf-8";
      $header = implode("\n", $optheader);

    // Mail versenden
      if ( mail($empfänger, $subject, $MailMessage, $header) ) { echo $L_142; }
      else { echo $L_151; }
      // URL bestimmen
        if ( $SetupGuestbookURL=='' ) $URL = $http_equiv;
          else $URL = $SetupGuestbookURL;
        $URL = str_replace("&","&amp;",$URL);
      echo '<br /><br /><br /><a href="'.$URL.'">'.$L_155.'</a>';
  }
  else
  {
    echo $L_Here_you_can_sent_a_message_to." ".$Name.":<br /><br />";
    
    echo '<div id="GuestbookEntryForm">
    <form action="'.$http_equiv.'" method="post" accept-charset="UTF-8">
      <table summary="Forumular">
    ';
    // Name
    if (isset($_POST['senden']) && ($_POST['name']==""))
    {
      echo '<tr><td></td><td class="GuestbookErrorMessages">'.$L_121.'</td><td></td></tr>';
    }
    if ( isset($_POST['name'] )) { $Name = $_POST['name']; }
    else { $Name = ''; }
    $Name = htmlspecialchars(stripslashes($Name));
    echo '
      <tr>
        <td align="right" valign="top">'.$L_114.':</td>
        <td>
          <input type="text" name="name" maxlength="40" value="'.$Name.'" />
        </td>
        <td valign="top">*</td>
      </tr>
    ';
    // Email
    if (isset($_POST['senden']) && ($_POST['email']==""))
    {
      echo '<tr><td></td><td class="GuestbookErrorMessages">'.$L_216.'</td><td></td></tr>';
    }
    if (isset($_POST['senden']) && $_POST['email']!="" && !checkEmail ($_POST['email']))
    {
      echo '<tr><td></td><td class="GuestbookErrorMessages">'.$L_122.'</td><td></td></tr>';
    }
    if ( isset($_POST['email'] )) { $Email = $_POST['email']; }
    else { $Email = ''; }    
    echo '
     <tr>
       <td align="right" valign="top">'.$L_115.':</td>
       <td>
         <input type="text" name="email" maxlength="80" value="'.$Email.'" />
       </td>
       <td valign="top">*</td>
     </tr>
    ';
    // Message
    if (isset($_POST['senden']) && ereg ( 'word:', $messageIsSpam ))
    { echo '<tr><td></td><td class="GuestbookErrorMessages">'.$L_124.'<br /></td><td></td></tr>'; }

    if (isset($_POST['senden']) && ($_POST['message']==""))
    {
      echo '<tr><td></td><td class="GuestbookErrorMessages">'.$L_125.'</td><td></td></tr>';
    }
    if (isset($_POST['senden']) && $messageIsSpam=='code')
      { echo '<tr><td></td><td class="GuestbookErrorMessages">'.$L_ERROR_Message_contains_invalide_characters.'</td><td></td></tr>'; }
    if ( isset($_POST['message'] )) { $Message = $_POST['message']; }
    else { $Message = ''; }
    $SCRIPT_URI = str_replace("&","&amp;",$_SERVER['HTTP_REFERER']);
    $Message = htmlspecialchars(stripslashes($Message));
    echo '
      <tr>
        <td align="right" valign="top">'.$L_119.':</td>
        <td><textarea name="message" rows="6" cols="">'.$Message.'</textarea></td>
        <td valign="top">*</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>
          <input type="submit" name="senden" value="Senden" class="button" />
          <input type="hidden" name="http-equiv" value="'.$SCRIPT_URI.'" />
          <input type="hidden" name="page" value="mail" />
          <input type="hidden" name="id" value="'.$GuestbookID.'" />
        </td>
        <td valign="top"></td>
      </tr>
      </table>
      </form></div>
    ';
  }
  echo '</div></div>';
?>
Return current item: GigKalender