php.de

Zurück   php.de > Webentwicklung > PHP Einsteiger > PHP Tipps 2009

 
 
LinkBack Themen-Optionen Bewertung: Bewertung: 1 Stimmen, 1,00 durchschnittlich.
Alt 20.05.2009, 22:48  
Neuer Benutzer
 
Registriert seit: 20.05.2009
Beiträge: 5
philomene ist zur Zeit noch ein unbeschriebenes Blatt
Standard [Erledigt] Parse error: syntax error, unexpected $end in

Ich bin ein Vollblutanfängerin auf dem gebiet aber habe mich natürlich an die mail.php gewagt: Ich wollte in meinem Onlineshop unter admin eine contribution einbauen, bei der ich attachments/bilder verschicken kann. Tja, nun ghet leider das Mailprogramm gar niocht mehr. Stattdessen heisst es: Parse error: syntax error, unexpected $end in /home/miandyu/public_html/shop/admin/mail.php on line 245.

Anbei das (abgeänderte) mail.php - herzlichen Dank für jegliche Hilfe

PHP-Code:
 <?php
/*
  $Id: mail.php,v 1.31 2003/06/20 00:37:51 hpdl Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/

  
require('includes/application_top.php');

  
$action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

  if ( (
$action == 'send_email_to_user') && isset($HTTP_POST_VARS['customers_email_address']) && !isset($HTTP_POST_VARS['back_x']) ) {
    switch (
$HTTP_POST_VARS['customers_email_address']) {
      case 
'***':
        
$mail_query tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " TABLE_CUSTOMERS);
        
$mail_sent_to TEXT_ALL_CUSTOMERS;
        break;
      case 
'**D':
        
$mail_query tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " TABLE_CUSTOMERS " where customers_newsletter = '1'");
        
$mail_sent_to TEXT_NEWSLETTER_CUSTOMERS;
        break;
      default:
        
$customers_email_address tep_db_prepare_input($HTTP_POST_VARS['customers_email_address']);
$from        tep_db_prepare_input($HTTP_POST_VARS['from']);
$subject     tep_db_prepare_input($HTTP_POST_VARS['subject']);
$message     tep_db_prepare_input($HTTP_POST_VARS['message']);
$mimemessage = new email(array('X-Mailer: osCommerce'));

if (isset(
$GLOBALS['userfile']) && tep_not_null($GLOBALS['userfile']))
       {  
$attachment_name   $HTTP_POST_FILES['userfile']['name'];
          
$attachment_type   $HTTP_POST_FILES['userfile']['type'];
      
//$attachment_size = $HTTP_POST_FILES['userfile']['size']; //Just in case you want to check and limit the size
          
new upload('userfile'DIR_FS_DOWNLOAD);
          
$attachment_file   DIR_FS_DOWNLOAD $attachment_name;
          
$attachments       $mimemessage->get_file($attachment_file);
          
$mimemessage->add_attachment($attachments$attachment_name$attachment_type);
       }

$mimemessage->add_text($message);
$mimemessage->build_message();
while (
$mail tep_db_fetch_array($mail_query)) {
$mimemessage->send($mail['customers_firstname'] . ' ' $mail['customers_lastname'], $mail['customers_email_address'], ''$from$subject);
                                          };

tep_redirect(tep_href_link(FILENAME_MAIL'mail_sent_to=' urlencode($mail_sent_to)));


tep_redirect(tep_href_link(FILENAME_MAIL'mail_sent_to=' urlencode($mail_sent_to)));


    
tep_redirect(tep_href_link(FILENAME_MAIL'mail_sent_to=' urlencode($mail_sent_to)));
  }

  if ( (
$action == 'preview') && !isset($HTTP_POST_VARS['customers_email_address']) ) {
    
$messageStack->add(ERROR_NO_CUSTOMER_SELECTED'error');
  }

  if (isset(
$HTTP_GET_VARS['mail_sent_to'])) {
    
$messageStack->add(sprintf(NOTICE_EMAIL_SENT_TO$HTTP_GET_VARS['mail_sent_to']), 'success');
  }
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET?>">
<title><?php echo TITLE?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<!-- header //-->
<?php require(DIR_WS_INCLUDES 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
  <tr>
    <td width="<?php echo BOX_WIDTH?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES 'column_left.php'); ?>
<!-- left_navigation_eof //-->
    </table></td>
<!-- body_text //-->
    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
        <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageHeading"><?php echo HEADING_TITLE?></td>
            <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif'HEADING_IMAGE_WIDTHHEADING_IMAGE_HEIGHT); ?></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
  
if ( ($action == 'preview') && isset($HTTP_POST_VARS['customers_email_address']) ) {
    switch (
$HTTP_POST_VARS['customers_email_address']) {
      case 
'***':
        
$mail_sent_to TEXT_ALL_CUSTOMERS;
        break;
      case 
'**D':
        
$mail_sent_to TEXT_NEWSLETTER_CUSTOMERS;
        break;
      default:
        
$mail_sent_to $HTTP_POST_VARS['customers_email_address'];
        break;
    }
?>
          <tr><?php echo tep_draw_form('mail'FILENAME_MAIL'action=send_email_to_user'); ?>
            <td><table border="0" width="100%" cellpadding="0" cellspacing="2">
              <tr>
                <td><?php echo tep_draw_separator('pixel_trans.gif''1''10'); ?></td>
              </tr>
              <tr>
                <td class="smallText"><b><?php echo TEXT_CUSTOMER?></b><br><?php echo $mail_sent_to?></td>
              </tr>
              <tr>
                <td><?php echo tep_draw_separator('pixel_trans.gif''1''10'); ?></td>
              </tr>
<tr>
    <td class="smallText"><b><?php echo TEXT_ATTACHMENT?></b><br><input name="userfile" type="file"></td>
</tr>
<tr>
    <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif''1''10'); ?></td>
</tr>
<tr>
                <td class="smallText"><b><?php echo TEXT_FROM?></b><br><?php echo htmlspecialchars(stripslashes($HTTP_POST_VARS['from'])); ?></td>
              </tr>
              <tr>
                <td><?php echo tep_draw_separator('pixel_trans.gif''1''10'); ?></td>
              </tr>
              <tr>
                <td class="smallText"><b><?php echo TEXT_SUBJECT?></b><br><?php echo htmlspecialchars(stripslashes($HTTP_POST_VARS['subject'])); ?></td>
              </tr>
              <tr>
                <td><?php echo tep_draw_separator('pixel_trans.gif''1''10'); ?></td>
              </tr>
              <tr>
                <td class="smallText"><b><?php echo TEXT_MESSAGE?></b><br><?php echo nl2br(htmlspecialchars(stripslashes($HTTP_POST_VARS['message']))); ?></td>
              </tr>
<td><?php echo tep_draw_separator('pixel_trans.gif''1''10'); ?></td>
<tr>
    <td class="smallText"><b><?php echo TEXT_ATTACHMENT?></b><br><input name="userfile" type="file"></td>
</tr>
<tr>
    <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif''1''10'); ?></td>
</tr>
              <tr>
                <td><?php echo tep_draw_separator('pixel_trans.gif''1''10'); ?></td>
              </tr>
              <tr>
                <td>
<?php
/* Re-Post all POST'ed variables */
    
reset($HTTP_POST_VARS);
    while (list(
$key$value) = each($HTTP_POST_VARS)) {
      if (!
is_array($HTTP_POST_VARS[$key])) {
        echo 
tep_draw_hidden_field($keyhtmlspecialchars(stripslashes($value)));
      }
     }
?>
                <table border="0" width="100%" cellpadding="0" cellspacing="2">
                  <tr>
                    <td><?php echo tep_image_submit('button_back.gif'IMAGE_BACK'name="back"'); ?></td>
                    <td align="right"><?php echo '<a href="' tep_href_link(FILENAME_MAIL) . '">' tep_image_button('button_cancel.gif'IMAGE_CANCEL) . '</a> ' tep_image_submit('button_send_mail.gif'IMAGE_SEND_EMAIL); ?></td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </form></tr>
<?php
  
} else {
?>
          <tr><?php echo tep_draw_form('mail'FILENAME_MAIL'action=preview'); ?>
            <td><table border="0" cellpadding="0" cellspacing="2">
              <tr>
                <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif''1''10'); ?></td>
              </tr>
<?php
    $customers 
= array();
    
$customers[] = array('id' => '''text' => TEXT_SELECT_CUSTOMER);
    
$customers[] = array('id' => '***''text' => TEXT_ALL_CUSTOMERS);
    
$customers[] = array('id' => '**D''text' => TEXT_NEWSLETTER_CUSTOMERS);
    
$mail_query tep_db_query("select customers_email_address, customers_firstname, customers_lastname from " TABLE_CUSTOMERS " order by customers_lastname");
    while(
$customers_values tep_db_fetch_array($mail_query)) {
      
$customers[] = array('id' => $customers_values['customers_email_address'],
                           
'text' => $customers_values['customers_lastname'] . ', ' $customers_values['customers_firstname'] . ' (' $customers_values['customers_email_address'] . ')');
    }
?>
              <tr>
                <td class="main"><?php echo TEXT_CUSTOMER?></td>
                <td><?php echo tep_draw_pull_down_menu('customers_email_address'$customers, (isset($HTTP_GET_VARS['customer']) ? $HTTP_GET_VARS['customer'] : ''));?></td>
              </tr>
              <tr>
                <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif''1''10'); ?></td>
              </tr>
              <tr>
                 <td class="main"><?php echo TEXT_FROM?></td>
                <td><?php echo tep_draw_input_field('from'EMAIL_FROM); ?></td>
              </tr>
              <tr>
                <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif''1''10'); ?></td>
              </tr>
              <tr>
                <td class="main"><?php echo TEXT_SUBJECT?></td>
                <td><?php echo tep_draw_input_field('subject'); ?></td>
              </tr>
              <tr>
                <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif''1''10'); ?></td>
              </tr>
              <tr>
                <td valign="top" class="main"><?php echo TEXT_MESSAGE?></td>
                <td><?php echo tep_draw_textarea_field('message''soft''60''15'); ?></td>
              </tr>
              <tr>
                <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif''1''10'); ?></td>
              </tr>
              <tr>
                <td colspan="2" align="right"><?php echo tep_image_submit('button_send_mail.gif'IMAGE_SEND_EMAIL); ?></td>
              </tr>
            </table></td>
          </form></tr>
<?php
  
}
?>
<!-- body_text_eof //-->
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES 'application_bottom.php'); ?>
philomene ist offline  
Sponsor Mitteilung
PHP Code Flüsterer

Registriert seit: 21.08.2005
Beiträge: 4682
PHP-Kenntnisse:
Fortgeschritten

Alt 20.05.2009, 22:50  
Moderator
 
Benutzerbild von Asipak
 
Registriert seit: 18.07.2005
Beiträge: 4.072
Asipak sorgt für eine eindrucksvolle AtmosphäreAsipak sorgt für eine eindrucksvolle Atmosphäre
Standard

Ohne mir jetzt deinen langen Code angeguckt zu haben, philomene, diese Meldung besagt meist, dass eine schließende geschweifte Klammer } vergessen wurde
Asipak ist offline  
Alt 20.05.2009, 22:55  
Erfahrener Benutzer
 
Registriert seit: 08.11.2004
Beiträge: 2.079
Der_Gerhard ist zur Zeit noch ein unbeschriebenes Blatt
Der_Gerhard eine Nachricht über ICQ schicken
Standard

Wo soll denn der erste Switch aufhören?

Sowas hier ist übrigens veraltet: $HTTP_POST_VARS
Nimm statt dessen lieber $_POST
__________________
**********************************
Nein, ich bin nicht die Signatur.
Ich putze hier nur.
**********************************
Der_Gerhard ist offline  
Alt 20.05.2009, 23:03  
Neuer Benutzer
 
Registriert seit: 20.05.2009
Beiträge: 5
philomene ist zur Zeit noch ein unbeschriebenes Blatt
Standard

Gerhard: Was ist ein SWITCH?
Asipak: .. tja, und WO fehlt die Klammer denn? Am Schluss? Daaanke
philomene ist offline  
Alt 20.05.2009, 23:05  
Moderator
 
Benutzerbild von Asipak
 
Registriert seit: 18.07.2005
Beiträge: 4.072
Asipak sorgt für eine eindrucksvolle AtmosphäreAsipak sorgt für eine eindrucksvolle Atmosphäre
Standard

Was Gerhard meint, ist dieser Teil:

PHP-Code:
    switch ($HTTP_POST_VARS['customers_email_address']) {
      case 
'***':
        
$mail_query tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " TABLE_CUSTOMERS);
        
$mail_sent_to TEXT_ALL_CUSTOMERS;
        break;
      case 
'**D':
        
$mail_query tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " TABLE_CUSTOMERS " where customers_newsletter = '1'");
        
$mail_sent_to TEXT_NEWSLETTER_CUSTOMERS;
        break;
      default:
        
$customers_email_address tep_db_prepare_input($HTTP_POST_VARS['customers_email_address']);
$from        tep_db_prepare_input($HTTP_POST_VARS['from']);
$subject     tep_db_prepare_input($HTTP_POST_VARS['subject']);
$message     tep_db_prepare_input($HTTP_POST_VARS['message']);
$mimemessage = new email(array('X-Mailer: osCommerce')); 
Da wird wohl auch die Klammer fehlen, wie er netterweise herausgefunden hat

Dort einfach noch

PHP-Code:
break;

hintersetzen und der Fehler sollte verschwinden! Das ist allerdings nur eine Vermutung. Wo die Switch-Anweisung wirklich enden soll ist aufgrund der "hübschen" Codeformatierung nicht eindeutig zu erkennen!
Asipak ist offline  
Alt 20.05.2009, 23:10  
PTC
Erfahrener Benutzer
 
Benutzerbild von PTC
 
Registriert seit: 27.10.2007
Beiträge: 1.708
PHP-Kenntnisse:
Anfänger
PTC ist einfach richtig nettPTC ist einfach richtig nettPTC ist einfach richtig nettPTC ist einfach richtig nett
Standard

Zitat:
Zitat von philomene Beitrag anzeigen
Gerhard: Was ist ein SWITCH?
Asipak: .. tja, und WO fehlt die Klammer denn? Am Schluss? Daaanke
http://www.php.de/php-einsteiger/489...rundlagen.html
PTC ist offline  
Alt 20.05.2009, 23:11  
Neuer Benutzer
 
Registriert seit: 20.05.2009
Beiträge: 5
philomene ist zur Zeit noch ein unbeschriebenes Blatt
Standard

Super lieben dank!!!!!!!!!
philomene ist offline  
Alt 21.05.2009, 12:16  
Erfahrener Benutzer
 
Benutzerbild von litterauspirna
 
Registriert seit: 24.04.2008
Beiträge: 3.172
PHP-Kenntnisse:
Anfänger
litterauspirna sorgt für eine eindrucksvolle Atmosphärelitterauspirna sorgt für eine eindrucksvolle Atmosphäre
litterauspirna eine Nachricht über ICQ schicken
Standard

Zitat:
Zitat von philomene Beitrag anzeigen
Gerhard: Was ist ein SWITCH?
Asipak: .. tja, und WO fehlt die Klammer denn? Am Schluss? Daaanke
Auch wenn du eine blutige Anfängerin bist (wir waren alle Anfänger) solltest du von Beginn an lernen Fehlermeldungen zu lesen und zu interpretieren. Wenn du eine Fehlermeldung nicht kennst, dann lasse dich nicht verunsichern und nutze Google, kopiere einfach die besagte Fehlermeldung mit den nötigen Teilen in Google Suchfeld, da wird dir meistens dann was geboten um dem Fehler auf die Schliche zu kommen.

Gruß litter
__________________
Aus dem Dynamo Lande kommen wir. Trinken immer reichlich kühles Bier. Und dann sind wir alle voll, die Stimmung ist so toll. Aus dem Dynamo Lande kommen wir.
http://www.lit-web.de
litterauspirna ist offline  
Alt 22.05.2009, 12:21  
Neuer Benutzer
 
Registriert seit: 20.05.2009
Beiträge: 5
philomene ist zur Zeit noch ein unbeschriebenes Blatt
Standard Leider ist da noch was

Liebe Leute, ich habe mich an das mail.php unter admin in meinem online shop gewagt, um ein add-on einzufügen, welches mir erlaubt, emails mit bildattachment zu vesrenden. Soweit hats auch geklappt, ich kann Bilder anfügen. Nur leider kommen die Mails nicht, wohl weil ich jeweils 2 Kunden auf dem Mail habe, wobei eines derjenige ist, den ich gewählt habe und der andere ist leer. Das sieht dann so aus:-

Kunde:
heinz@heinz.ch
TEXT_ATTACHMENT
Absender:
ich@ich.ch

Betreff:
Nachricht:
TEXT_ATTACHMENT

Meine mail.php:


PHP-Code:
<?php
/*
$Id: mail.php,v 1.31 2003/06/20 00:37:51 hpdl Exp $

osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Copyright © 2003 osCommerce

Released under the GNU General Public License
*/

require('includes/application_top.php');

$action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

if ( (
$action == 'send_email_to_user') && isset($HTTP_POST_VARS['customers_email_address']) && !isset($HTTP_POST_VARS['back_x']) ) {
switch (
$HTTP_POST_VARS['customers_email_address']) {
case 
'***':
$mail_query tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " TABLE_CUSTOMERS);
$mail_sent_to TEXT_ALL_CUSTOMERS;
break;
case 
'**D':
$mail_query tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " TABLE_CUSTOMERS " where customers_newsletter = '1'");
$mail_sent_to TEXT_NEWSLETTER_CUSTOMERS;
break;
default:
$customers_email_address tep_db_prepare_input($HTTP_POST_VARS['customers_email_address']);
$from tep_db_prepare_input($_POST['from']);
$subject tep_db_prepare_input($_POST['subject']);
$message tep_db_prepare_input($_POST['message']);
$mimemessage = new email(array('X-Mailer: osCommerce'));
}

if (isset(
$GLOBALS['userfile']) && tep_not_null($GLOBALS['userfile']))
$attachment_name $HTTP_POST_FILES['userfile']['name'];
$attachment_type $HTTP_POST_FILES['userfile']['type'];
//$attachment_size = $HTTP_POST_FILES['userfile']['size']; //Just in case you want to check and limit the size
new upload('userfile'DIR_FS_DOWNLOAD);
$attachment_file DIR_FS_DOWNLOAD $attachment_name;
$attachments $mimemessage->get_file($attachment_file);
$mimemessage->add_attachment($attachments$attachment_name$attachment_type);
}

$mimemessage->add_text($message);
$mimemessage->build_message();
while (
$mail tep_db_fetch_array($mail_query)) {
$mimemessage->send($mail['customers_firstname'] . ' ' $mail['customers_lastname'], $mail['customers_email_address'], ''$from$subject);
};

tep_redirect(tep_href_link(FILENAME_MAIL'mail_sent_to=' urlencode($mail_sent_to)));


tep_redirect(tep_href_link(FILENAME_MAIL'mail_sent_to=' urlencode($mail_sent_to)));


tep_redirect(tep_href_link(FILENAME_MAIL'mail_sent_to=' urlencode($mail_sent_to)));
}

if ( (
$action == 'preview') && !isset($HTTP_POST_VARS['customers_email_address']) ) {
$messageStack->add(ERROR_NO_CUSTOMER_SELECTED'error');
}

if (isset(
$HTTP_GET_VARS['mail_sent_to'])) {
$messageStack->add(sprintf(NOTICE_EMAIL_SENT_TO$HTTP_GET_VARS['mail_sent_to']), 'success');
}
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET?>">
<title><?php echo TITLE?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<!-- header //-->
<?php require(DIR_WS_INCLUDES 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
<tr>
<td width="<?php echo BOX_WIDTH?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="pageHeading"><?php echo HEADING_TITLE?></td>
<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif'HEADING_IMAGE_WIDTHHEADING_IMAGE_HEIGHT); ?></td>
</tr>
</table></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
if ( ($action == 'preview') && isset($HTTP_POST_VARS['customers_email_address']) ) {
switch (
$HTTP_POST_VARS['customers_email_address']) {
case 
'***':
$mail_sent_to TEXT_ALL_CUSTOMERS;
break;
case 
'**D':
$mail_sent_to TEXT_NEWSLETTER_CUSTOMERS;
break;
default:
$mail_sent_to $HTTP_POST_VARS['customers_email_address'];
break;
}
?>
<tr><?php echo tep_draw_form('mail'FILENAME_MAIL'action=send_email_to_user'); ?>
<td><table border="0" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif''1''10'); ?></td>
</tr>
<tr>
<td class="smallText"><b><?php echo TEXT_CUSTOMER?></b><br><?php echo $mail_sent_to?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif''1''10'); ?></td>
</tr>
<tr>
<td class="smallText"><b><?php echo TEXT_ATTACHMENT?></b><br><input name="userfile" type="file"></td>
</tr>
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif''1''10'); ?></td>
</tr>
<tr>
<td class="smallText"><b><?php echo TEXT_FROM?></b><br><?php echo htmlspecialchars(stripslashes($HTTP_POST_VARS['from'])); ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif''1''10'); ?></td>
</tr>
<tr>
<td class="smallText"><b><?php echo TEXT_SUBJECT?></b><br><?php echo htmlspecialchars(stripslashes($HTTP_POST_VARS['subject'])); ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif''1''10'); ?></td>
</tr>
<tr>
<td class="smallText"><b><?php echo TEXT_MESSAGE?></b><br><?php echo nl2br(htmlspecialchars(stripslashes($HTTP_POST_VARS['message']))); ?></td>
</tr>
<td><?php echo tep_draw_separator('pixel_trans.gif''1''10'); ?></td>
<tr>
<td class="smallText"><b><?php echo TEXT_ATTACHMENT?></b><br><input name="userfile" type="file"></td>
</tr>
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif''1''10'); ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif''1''10'); ?></td>
</tr>
<tr>
<td>
<?php
/* Re-Post all POST'ed variables */
reset($HTTP_POST_VARS);
while (list(
$key$value) = each($HTTP_POST_VARS)) {
if (!
is_array($HTTP_POST_VARS[$key])) {
echo 
tep_draw_hidden_field($keyhtmlspecialchars(stripslashes($value)));
}
}
?>
<table border="0" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><?php echo tep_image_submit('button_back.gif'IMAGE_BACK'name="back"'); ?></td>
<td align="right"><?php echo '<a href="' tep_href_link(FILENAME_MAIL) . '">' tep_image_button('button_cancel.gif'IMAGE_CANCEL) . '</a> ' tep_image_submit('button_send_mail.gif'IMAGE_SEND_EMAIL); ?></td>
</tr>
</table></td>
</tr>
</table></td>
</form></tr>
<?php
} else {
?>
<tr><?php echo tep_draw_form('mail'FILENAME_MAIL'action=preview'); ?>
<td><table border="0" cellpadding="0" cellspacing="2">
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif''1''10'); ?></td>
</tr>
<?php
$customers 
= array();
$customers[] = array('id' => '''text' => TEXT_SELECT_CUSTOMER);
$customers[] = array('id' => '***''text' => TEXT_ALL_CUSTOMERS);
$customers[] = array('id' => '**D''text' => TEXT_NEWSLETTER_CUSTOMERS);
$mail_query tep_db_query("select customers_email_address, customers_firstname, customers_lastname from " TABLE_CUSTOMERS " order by customers_lastname");
while(
$customers_values tep_db_fetch_array($mail_query)) {
$customers[] = array('id' => $customers_values['customers_email_address'],
'text' => $customers_values['customers_lastname'] . ', ' $customers_values['customers_firstname'] . ' (' $customers_values['customers_email_address'] . ')');
}
?>
<tr>
<td class="main"><?php echo TEXT_CUSTOMER?></td>
<td><?php echo tep_draw_pull_down_menu('customers_email_address'$customers, (isset($HTTP_GET_VARS['customer']) ? $HTTP_GET_VARS['customer'] : ''));?></td>
</tr>
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif''1''10'); ?></td>
</tr>
<tr>
<td class="main"><?php echo TEXT_FROM?></td>
<td><?php echo tep_draw_input_field('from'EMAIL_FROM); ?></td>
</tr>
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif''1''10'); ?></td>
</tr>
<tr>
<td class="main"><?php echo TEXT_SUBJECT?></td>
<td><?php echo tep_draw_input_field('subject'); ?></td>
</tr>
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif''1''10'); ?></td>
</tr>
<tr>
<td valign="top" class="main"><?php echo TEXT_MESSAGE?></td>
<td><?php echo tep_draw_textarea_field('message''soft''60''15'); ?></td>
</tr>
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif''1''10'); ?></td>
</tr>
<tr>
<td colspan="2" align="right"><?php echo tep_image_submit('button_send_mail.gif'IMAGE_SEND_EMAIL); ?></td>
</tr>
</table></td>
</form></tr>
<?php
}
?>
<!-- body_text_eof //-->
</table></td>
</tr>
</table></td>
</tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES appli

Und hier die anleitung, das ich (wohl nicht ganz korrekt...) befolgt habe:


PHP-Code:
Description:

This contribution will allow you to send email to customers with an attachment included (from the admin panel) , there are no filetype or size limitations.
Only the store administrator will be able to use this option.

Requeriments:

A] Your hosting provider must allow uploads, go to your administration panel and click on "Tools" then click on "Server Info" (left menu) and search for:

file_uploads On On

If it's off then switch hosting providers.

B] Using a FTP program, set '777' as permission to folder "download" inside catalog."catalog" is your store's root folder.

Procedure:

1] Go to: 'catalog\admin\includes\languages\english\mail.php'
2] add

define('TEXT_ATTACHMENT','File attachment:');

3] Go to: 'catalog\admin\includes\languages\espanol\mail.php'
4] add

define('TEXT_ATTACHMENT','Archivo adjunto:');

5] Go to: 'catalog\admin\includes\configure.php'
6] add

define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');

7] Go to: 'catalog\admin\mail.php'
8] Search for (line 35 or so):

$from = tep_db_prepare_input($HTTP_POST_VARS['from']);

9] Delete or comment the next lines until you reach:

tep_redirect(tep_href_link(FILENAME_MAIL, 'mail_sent_to=' . urlencode($mail_sent_to)));

10] Add this code into that place (note that this code starts with [8] and ends with [9]) :

$from = tep_db_prepare_input($HTTP_POST_VARS['from']);
$subject = tep_db_prepare_input($HTTP_POST_VARS['subject']);
$message = tep_db_prepare_input($HTTP_POST_VARS['message']);
$mimemessage = new email(array('X-Mailer: osCommerce'));

if (isset($GLOBALS['userfile']) && tep_not_null($GLOBALS['userfile']))
{ $attachment_name = $HTTP_POST_FILES['userfile']['name'];
$attachment_type = $HTTP_POST_FILES['userfile']['type'];
//$attachment_size = $HTTP_POST_FILES['userfile']['size']; //Just in case you want to check and limit the size
new upload('userfile', DIR_FS_DOWNLOAD);
$attachment_file = DIR_FS_DOWNLOAD . $attachment_name;
$attachments = $mimemessage->get_file($attachment_file);
$mimemessage->add_attachment($attachments, $attachment_name, $attachment_type);
}

$mimemessage->add_text($message);
$mimemessage->build_message();
while ($mail = tep_db_fetch_array($mail_query)) {
$mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', $from, $subject);
};

tep_redirect(tep_href_link(FILENAME_MAIL, 'mail_sent_to=' . urlencode($mail_sent_to)));


11] At the same file (catalog\admin\mail.php) Search for (line 135 or so):

<tr>
<td class="smallText"><b><?php echo TEXT_MESSAGE?></b><br><?php echo nl2br(htmlspecialchars(stripslashes($HTTP_POST_VARS['message']))); ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif''1''10'); ?></td>
</tr>

12] Add after it:

<tr>
<td class="smallText"><b><?php echo TEXT_ATTACHMENT?></b><br><input name="userfile" type="file"></td>
</tr>
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif''1''10'); ?></td>
</tr>

13] Enjoy!


NOTE: The add attachment option will be visible on the EMAIL CONFIRMATION SCREEN (This is the SECOND screen that appears when you click on "send mail" at the "Send Email To Customers" screen).
Remember, on the "Send Email To Customers" screen choose your destination emails, type subject and message, then click on "send mail" and the add attachment option will appear on the next screen.

This was tested with .rar, .doc, .xls and .pdf files without problems, should work for others too. Hotmail and Gmail accounts received and downloaded the attachment without problems.

If you dont want to include an attachment just leave the file upload field blank (dont choose a file). The email will be sent without attachment as it does by default.
!
philomene ist offline  
 


Themen-Optionen
Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an
Gehe zu

Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Parse error: parse error, unexpected ';' in... cycap PHP Tipps 2006 2 27.01.2006 20:09
Parse error: syntax error, unexpected $end in D:\xampp\htdoc PHP Tipps 2005-2 11 11.10.2005 17:05
Parse error: parse error, unexpected T_VARIABLE schmiddy PHP Tipps 2005 7 02.06.2005 13:35
parse error, unexpected $end in.. ==> Editor gesucht PHP Tipps 2005 3 03.03.2005 16:01
Parse error: parse error, unexpected '{' PHP Tipps 2005 10 23.01.2005 16:59
verblüffend: Parse error: parse error, unexpected T_STRING, PHP Tipps 2004 1 07.10.2004 09:05
Parse error: parse error, unexpected $ smoere PHP Tipps 2004 2 27.09.2004 20:18
Parse error: parse error in /srv/www/htdocs/web27/html/kunde PHP Tipps 2004 3 19.09.2004 18:14
Parse error: unexpected $end ... on line xy PHP Tipps 2004 2 18.09.2004 13:18
Parse error: parse error, unexpected $end PHP Tipps 2004 2 24.08.2004 16:28
Script Problem: parse error unexpected $end PHP Tipps 2004 5 02.08.2004 13:25
Parse error: parse error, unexpected $end PHP Tipps 2004 5 13.07.2004 14:34
Parse error: parse error, unexpected $ Hilfe!!! PHP Tipps 2004 8 29.06.2004 21:51

Besucher kamen über folgende Suchanfragen bei Google auf diese Seite
parse error: syntax error, unexpected $end in, parse error: syntax error, unexpected $end, parse error syntax error unexpected $end in, parse error syntax error unexpected end in, syntax error, unexpected $end, parse error: syntax error, unexpected t_if in, parse error syntax error unexpected $end, parse error: syntax error, unexpected t_dnumber, \parse error: syntax error, unexpected $end\, syntax error, unexpected $end in, \parse error: syntax error, unexpected $end in\, parse error: syntax error, unexpected $end in /, parse error syntax error unexpected $end in on line, parse error: syntax error, unexpected t_logical_or, parse error: syntax error, unexpected $end in c, parse error: syntax error, unexpected t_while in, parse error: syntax error, unexpected t_if, parse error: syntax error, unexpected $end i, parse error syntax error unexpected end, parse error: syntax error, unexpected t_boolean_and

Alle Zeitangaben in WEZ +2. Es ist jetzt 16:08 Uhr.




Powered by vBulletin® Version 3.7.2 (Deutsch)
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Aprilia-Forum, Aquaristik-Forum, Liebeskummer-Forum, Zierfisch-Forum, Geizkragen-Forum