php.de

Zurück   php.de > Webentwicklung > PHP Einsteiger > PHP Tipps 2005-2

 
 
LinkBack Themen-Optionen Thema bewerten
Alt 27.08.2005, 11:32  
Gast
 
Beiträge: n/a
Standard From-Mailadresse aus Formular auslesen klappt nicht

Ich habe einen einfachen Formmailer, der die Daten aus einem Formular übernimmt und an meine eMailadresse schickt. Hab im cript schon alles geändert und gewerkelt, so dass es für mich passt, aber eines bekomme ich partout nicht hin. Ich möchte die eMailadresse, die der jeweilige Benutzer im Formularfeld "r_Email" eingibt in den Mails jeweils als From-Adresse erscheint. Also so, dass ich z.B. nur auf die Mail Antworten muss und sie dann beim Benutzer landet. Ne feste From-Adresse eintragen geht, ist klar, aber ich kriegs nicht gebacken, die "r_Email" auszulesen udn weiterzugeben. Unten das Script, ich habe es mal in voller Länge kopiert, auch wenn es ein bißchen lang ist. Über jeglichen Tip wäre ich dankbar. Meine Versuche habe ich wieder entfernt, um das Script wieder übersichtlich zu machen
PHP-Code:
<?

// ##########################################################################
// ##########################################################################
//
//  DynaForm v1.4 - Created by the Webligo Group
//                  [url]http://www.webligo.com[/url]
//
//  YOUR USE OR DISTRIBUTION OF THIS SOFTWARE CONSTITUTES YOUR ACCEPTANCE
//  OF THE FOLLOWING LICENSE AGREEMENT: 
//
//  THIS SCRIPT AND ALL OF ITS CONTENTS ARE LICENSED UNDER THE
//  GPL FREEWARE LICENSE. IT MAY NOT BE RESOLD OUR USED COMMERCIALLY
//  WITHOUT EXPRESSED PERMISSION OF THE WEBLIGO GROUP. IT MAY, HOWEVER,
//  BE DISTRIBUTED FREELY WITHOUT CHARGE. THIS SOFTWARE IS INTELLECTUAL
//  PROPERTY OF THE WEBLIGO GROUP. ANYONE VIOLATING THIS AGREEMENT WITHOUT
//  THE EXPRESSED PERMISSION OF THE WEBLIGO GROUP MAY BE LEGALLY PROSECUTED.
//  YOUR DOWNLOAD AND USE OF THIS SOFTWARE ALSO SIGNIFIES THAT YOU UNDERSTAND
//  AND AGREE TO THE DOWNLOAD AGREEMENT YOU READ UPON DOWNLOAD.
//
//  The Webligo Group, its management, or any of its employees, associates, or 
//  partners cannot be held liable for any damages that this software may cause. 
//  As the Licensee and user of the software, you agree to accept full liability 
//  for any damages or risk involved with using this software.
//
//  If you need help installing or using this software, please
//  read the readme.txt file that was provided with it.
//
//  This file and all related content are the intellectual
//  property of the Webligo Group and are under copyright.
//
//  If you plan to use this script for your clients, sell it as a service,
//  or utilize it in any other commercial manner, you must purchase a commercial
//  license. Please see this page for more information:
//  [url]http://webligo.com/products_dynaform.php[/url]
//
//  We do not provide support for this script, unless you have purchased a
//  commercial license.
//
//  Feel free to visit our website ([url]http://www.webligo.com[/url])
//  if you wish to send us any comments, etc.
//
// ###########################################################################
// ###########################################################################





// ###########################################################################
// #### CONFIGURE FROM: ADDRESS ##############################################

// THIS AREA IS OPTIONAL. ONLY TOUCH THESE SETTINGS IF YOU KNOW WHAT YOU ARE
// DOING. PLEASE READ README.TXT FOR MORE INFORMATION.

// If you would like to specify the From: address of emails sent by DynaForm,
// enter it between the double quotes below. If you leave this blank, the
// server will assign the default email address.

$from_address "";

// ###########################################################################
// ###########################################################################





// ###########################################################################
// #### ACTIVATE REQUIRED FIELDS? ############################################

// THIS AREA IS OPTIONAL. ONLY TOUCH THESE SETTINGS IF YOU KNOW WHAT YOU ARE
// DOING. PLEASE READ README.TXT FOR MORE INFORMATION.
//
// If you would like to make some fields of your form required, change "no" to
// "yes" below.

$required_on "yes";

// If you have set $required_on to "yes" above, you can make fields required
// by beginning their name with "r_". For example, if you want to require
// a user to enter their name, use the following HTML:
//
// <input type='text' name='r_Name'>
//
// If a user fails to enter a required field, they will be taken to a page
// where a message such as "You have not completed all the required fields."
// will be displayed. Please specify the URL to this file below:

$required_errorpage "/html/fehler.html";

// ###########################################################################
// ###########################################################################





// ###########################################################################
// #### OVERRIDE REQUIRED VARIABLES? #########################################

// THIS AREA IS OPTIONAL. ONLY TOUCH THESE SETTINGS IF YOU KNOW WHAT YOU ARE
// DOING. PLEASE READ README.TXT FOR MORE INFORMATION. NOTE: THIS WILL NOT
// AFFECT YOUR 'TURN ON REQUIRED FIELDS?' SECTION SETTINGS ABOVE.
//
// If you would like to override the three required variables in
// order to hide your email address, email subject, and thank you page
// URL from your email form, change "no" to "yes" below.

$override "yes";

// If override is set to "yes", the hidden variables on your HTML
// email form named "rec_mailto", "rec_subject", and "rec_thanks" will be
// overridden and can therefore be removed from the form.

// If you have set override to "yes" above, you must specify new values for
// each of these variables below.

// Enter the email address(es) to send the email to.
$incoming_mailto "bestellung@xyz.de";

// Enter the email subject.
$incoming_subject "Fotobestellung";

// Enter the thank you page URL.
$incoming_thanks "/html/danke.html";

// ###########################################################################
// ###########################################################################





// ###########################################################################
// #### BAN IP ADDRESSES? ####################################################

// THIS AREA IS OPTIONAL. ONLY TOUCH THESE SETTINGS IF YOU KNOW WHAT YOU ARE
// DOING. PLEASE READ README.TXT FOR MORE INFORMATION.
//
// If you would like to ban certain IP addresses from submitting your form,
// change "no" to "yes" below.

$ban_ip_on "no";

// If you have set $ban_ip_on to "yes" above, please enter a list of the
// IP addresses you would like to ban, seperated only by commas.
// An example has been provided below:

$ban_ip_list "111.222.33.55,11.33.777.99";

// ###########################################################################
// ###########################################################################





// ###########################################################################
// #### ACTIVATE DOMAIN SECURITY? ############################################
//
// THIS AREA IS OPTIONAL. ONLY TOUCH THESE SETTINGS IF YOU KNOW WHAT YOU ARE
// DOING. PLEASE READ README.TXT FOR MORE INFORMATION.
//
// This setting, when set to "yes" (default), will check to make sure other
// people are not submitting data to your dynaform.php file from their
// external domains. This means that if your domain name is "www.mysite.com",
// only forms on "www.mysite.com" will be able to use this dynaform.php.
// IF YOU ARE RECEIVING ERRORS SUCH AS "INVALID DOMAIN" FOR NO REASON, PLEASE
// CHANGE "yes" TO "no" BELOW.

$secure_domain_on "no";

// ###########################################################################
// ###########################################################################




// ###########################################################################
// #### ACTIVATE AUTO-RESPONSE? ##############################################
//
// THIS AREA IS OPTIONAL. ONLY TOUCH THESE SETTINGS IF YOU KNOW WHAT YOU ARE
// DOING. PLEASE READ README.TXT FOR MORE INFORMATION.
//
// This setting, when set to "yes", will make DynaForm automatically reply to
// the user who submitted your form with an email message. If you would like
// to use this feature, change "no" to "yes" below.

$autorespond_on "no";

// If you have set $autorespond_on to "yes" above, you must specify a subject,
// from-address, and message to include in the auto-response email.

// The following setting is the subject of the auto-response email:
$autorespond_subject "Submission photo order";

// The following setting is the from-address of the auto-respond email:
$autorespond_from "bestellung@xyz.de";

// The following setting is the message of your auto-response email:
$autorespond_contents "Your submission from our website has been received. Thank you!";

// DynaForm also needs to know how to retrieve the user's email address.
// You must specify the name of the field into which the user will enter
// their email address. For example, if your email form contains an input
// field like "<input type='text' name='Email'>" you would set the
// following setting to "Email".
$autorespond_mailto_field "r_Email";

// ###########################################################################
// ###########################################################################










// MAKE SURE DYNAFORM IS NOT BEING LOADED FROM THE URL
if($HTTP_SERVER_VARS['REQUEST_METHOD'] == "GET") {
echo 
"
<html>
<head><title>Webligo PHP DynaForm is installed correctly.</title></head>
<body>
<font style='font-family: verdana, arial; font-size: 9pt;'>
[b]DynaForm is installed correctly.[/b]</font>

<font style='font-family: verdana, arial; font-size: 8pt;'>
DynaForm Easy PHP Form Mailer was created by [url='http://www.webligo.com']Webligo Developments[/url].
</font>
</body></html>
"
;
exit();
}

// SET VARIABLES
$incoming_fields array_keys($HTTP_POST_VARS);
$incoming_values array_values($HTTP_POST_VARS);

if(
$override == "no") {
$incoming_mailto = @$HTTP_POST_VARS[''];
$incoming_subject = @$HTTP_POST_VARS['rec_subject'];
$incoming_thanks = @$HTTP_POST_VARS['rec_thanks'];
}

$incoming_mailto_cc = @$HTTP_POST_VARS['opt_mailto_cc'];
$incoming_mailto_bcc = @$HTTP_POST_VARS['opt_mailto_bcc'];
$form_url = @$HTTP_REFERER;

// MAKE SURE DYNAFORM IS BEING RUN FROM THE RIGHT DOMAIN
if($secure_domain_on == "yes") {
$form_url_array parse_url($form_url);
$form_domain $form_url_array[host];
if(
$form_domain != $HTTP_SERVER_VARS[HTTP_HOST]) {
echo 
"<h2>DynaForm Error - Invalid Domain</h2>
You have accessed DynaForm from an external domain - this is not allowed.

You may only submit forms to a DynaForm file that exists on the same domain name.

If you believe to be receiving this message in error, please refer to your readme.txt file.


"
;
$error "yes";
}
}

// CHECK IF MAILTO IS SET
if($incoming_mailto == "") {
echo 
"<h2>DynaForm Error - Missing Field</h2>
Your form located at [url='$form_url']$form_url[/url] does not work because you forgot to include
the required \"[b]rec_mailto[/b]\" field within the form. This field specifies who the email will
be sent to.



This should look like:

<input type=\"hidden\" name=\"rec_mailto\" value=\"youremail@yoursite.com\">



If you are still confused, please refer to the readme.txt for more information and examples.




"
;
$error "yes";
}

// CHECK IF SUBJECT IS SET
if($incoming_subject == "") {
echo 
"<h2>DynaForm Error - Missing Field</h2>
Your form located at [url='$form_url']$form_url[/url] does not work because you forgot to include
the required \"[b]rec_subject[/b]\" field within the form. This field specifies the subject of
the email that will be sent.



This should look like:

<input type=\"hidden\" name=\"rec_subject\" value=\"New DynaForm Email\">



If you are still confused, please refer to the readme.txt for more information and examples.




"
;
$error "yes";
}

// CHECK IF THANKS IS SET
if($incoming_thanks == "") {
echo 
"<h2>DynaForm Error - Missing Field</h2>
Your form located at [url='$form_url']$form_url[/url] does not work because you forgot to include
the required \"[b]rec_thanks[/b]\" field within the form. This field specifies what page the user
will be taken to after they submit the form.



This should look like:

<input type=\"hidden\" name=\"rec_thanks\" value=\"thanks.html\">



If you are still confused, please refer to the readme.txt for more information and examples.




"
;
$error "yes";
}

// CHECK IF IP ADDRESS IS BANNED
if($ban_ip_on == "yes") {

if(
strstr($ban_ip_list$HTTP_SERVER_VARS[REMOTE_ADDR])) {
echo 
"<h2>DynaForm Error - Banned IP</h2>
You cannot use this form because your IP address has been banned by the administrator.

"
;
$error "yes";
}
}


if(
$error == "yes") {
exit();
}


// LOAD EMAIL CONTENTS 
for ($i 0$i count($incoming_fields); $i++) { 
if(
$incoming_fields[$i] != "rec_mailto") {
if(
$incoming_fields[$i] != "rec_subject") {
if(
$incoming_fields[$i] != "rec_thanks") {
if(
$incoming_fields[$i] != "opt_mailto_cc") {
if(
$incoming_fields[$i] != "opt_mailto_bcc") {

// CHECK FOR REQUIRED FIELDS IF ACTIVATED
if($required_on == "yes") {
$sub substr($incoming_fields[$i], 02);
if(
$sub == "r_") {
if(
$incoming_values[$i] == "" OR !isset($incoming_values[$i]) OR $incoming_values[$i] == " ") {
header("Location: $required_errorpage");
exit();
}}}

// ADD FIELD TO OUTGOING MESSAGE
$message .= "$incoming_fields[$i]:\t\t$incoming_values[$i]\n";
}}}}}}

// CLEAR HEADERS
$headers "";

// ADD FROM ADDRESS
if($from_address != "") {
$headers .= "From: $from_address\r\n";
}

// CHECK FOR CC OR BCC
if($incoming_mailto_cc != "") {
$headers .= "Cc: $incoming_mailto_cc\r\n";
}
if(
$incoming_mailto_bcc != "") {
$headers .= "Bcc: $incoming_mailto_bcc\r\n";
}

// SEND EMAIL
mail($incoming_mailto$incoming_subject$message$headers);

// SEND AUTO-RESPONSE IF ACTIVATED
if($autorespond_on == "yes") {
$autorespond_mailto = @$HTTP_POST_VARS[$autorespond_mailto_field];
$autorespond_headers "From: $autorespond_from";
mail($autorespond_mailto$autorespond_subject$autorespond_contents$autorespond_headers);
}

// FORWARD TO THANK YOU PAGE
header("Location: $incoming_thanks"); 


?>
 
Sponsor Mitteilung
PHP Code Flüsterer

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

Alt 27.08.2005, 12:49  
Gast
 
Beiträge: n/a
Standard

Poste mal dein Formular. (und schneid bitte die überflüssigen Kommentare raus )
Die Variablen sind case sensitiv. Schätze r_Email wird daher nicht funktionieren.
 
Alt 27.08.2005, 12:55  
Gast
 
Beiträge: n/a
Standard

r_Email ist schon korrekt. Ist ja auch beim Autoresponder eingetragen und das funktioniert die Variable.
Hier ist das entsprechende Zeile aus dem Formular:
PHP-Code:

<font face="Verdana,Tahoma,Arial,Helvetica,Sans-serif,sans-serif" size="-1"><input id="Eingabefeld15" name="r_Email" value="" size="58" maxlength="58" type="text"></font></p></td
 
Alt 27.08.2005, 14:06  
Gast
 
Beiträge: n/a
Standard

Wenn du das Formular absendest, kommentiere auf deiner ziel.php
das Versenden der eMail aus, und schau mit

var_dump($HTTP_SERVER_VARS[post]);

mal nach was wie ankommt.
 
 


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
Formular Pflichtfelder für Frontpage Formular erstellen Caruso JavaScript, Ajax und mehr 5 21.06.2008 09:17
Parsen von Delimitern Basti Tutorials 0 30.09.2006 21:24
php-file wird downgeloadet dws Server, Hosting und Workstations 10 19.04.2006 18:45
[Erledigt] gelöst: Tabelle auslesen -&amp;amp;amp;amp;gt; Gleiche Einträge nur 1 Mal Datenbanken 3 31.03.2006 01:44
formular includen samspa5 PHP Tipps 2006 13 18.03.2006 11:37
Datenbank auslesen, in Formular darstellen und �ndern PHP Tipps 2006 8 22.02.2006 17:51
Formular: $POST bei Frames GSJLink PHP Tipps 2006 7 19.01.2006 19:51
Variable aus Formular auslesen .. PHP Tipps 2005-2 10 25.10.2005 15:48
[Erledigt] Formular in Formular HTML, Usability und Barrierefreiheit 4 19.10.2005 12:18
Daten eintragen und auslesen Rettungsdackel Datenbanken 0 14.09.2005 16:29
libmysqlclient.so.10 is needed Datenbanken 11 20.06.2005 15:27
Befehlsoptimierung faux Datenbanken 4 31.05.2005 19:11
[Erledigt] PHP Formular ~~wichtig~~ PHP Tipps 2005 27 29.05.2005 19:38
wert aus formular feld auslesen PHP Tipps 2004-2 1 11.11.2004 23:52

Besucher kamen über folgende Suchanfragen bei Google auf diese Seite
webligo, unten dynaform, you have accessed dynaform from an external domain - this is not allowed. you may only submit forms to a dynaform file that exists on the same domain name. if you believe to be receiving this message in error, please refer to your readme.txt file.

Alle Zeitangaben in WEZ +2. Es ist jetzt 06:35 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

Creative Commons License
Dieser Inhalt ist unter einer Creative Commons-Lizenz lizenziert.