^_^
Verfasst: Sa 7. Jan 2006, 18:25
^_^
Das Diskussionsforum zum Open Source Content Management System
https://www.forum.contenido.org/
i-fekt, als rookie kann ich nicht wirklich helfen, aaaaaaaaaaaaaberi-fekt hat geschrieben:Neeeeeiiiiiin.
Code: Alles auswählen
//Integration der phpmailer-Klasse
include ("../contenido/classes/class.phpmailer.php");
class w3form {
var $email, $aufgedroeselt, $form, $formularFeld;
function w3form() {
}
// Umgestellt auf phpmailer und evtl. Aufruf der vCard-Erstellung und Anhang
.
.
.
ich bin auch schon die ganze zeit am probieren/sufu/googlen ...i-fekt hat geschrieben:Man muss ja aber irgendwie ein file-Feld erzeugen, das das Modul rafft.
Code: Alles auswählen
<div style="clear: both; width: 100%">
<div style="clear: both; width: 100%"> </div>
<div style="clear: both; width: 100%"> <h1>Kontaktformular</h1> </div>
<div style="clear: both; width: 100%">
<div style="float: right; padding-right: 38px; color: rgb(236, 162, 20); background-color: rgb(255, 255, 255)">Bitte alle Felder ausfüllen.</div>
</div>
<div style="clear: both; width: 100%">
<div style="float: left; width: 120px; text-align: left">Anrede</div>
<div style="float: left; text-align: left">###name:gender; type:select; valid:simpletext; size:1; option:bitte wählen ; optionvalue:bitte wählen ; option:Frau; optionvalue:Frau; option:Herr; optionvalue:Herr; value:1; minvalue:1###</div>
</div>
<div style="clear: both; width: 100%"> <div style="float: left; width: 120px; text-align: left">Vorname:</div>
<div style="float: left; text-align: left">###name:firstname; type:text; valid:text; mandatory:true; size:19 ###</div>
</div>
<div style="clear: both; width: 100%">
<div style="float: left; width: 120px; text-align: left">Name:</div>
<div style="float: left; text-align: left">###name:name; type:text; valid:text; mandatory:true; size:19 ###</div>
</div>
<div style="clear: both; width: 100%"> <div style="float: left; width: 120px; text-align: left">E-Mail:</div>
<div style="float: left; text-align: left">###name:email; type:text; valid:email; mandatory:true; size:19 ###</div>
</div>
<div style="clear: both; width: 100%"> </div>
<div style="clear: both; width: 100%">
<div style="float: left; width: 120px; text-align: left">Betreff:</div>
<div style="float: left; text-align: left">###name:subject; type:text; mandatory:true; size:30 ###</div>
</div>
<div style="clear: both; width: 100%">
<div style="float: left; width: 120px; text-align: left">Nachricht:</div>
<div style="float: left; text-align: left">###name:message; type:textarea; mandatory:true; cols:50; rows:8; minlenght:30 ###</div>
</div>
<div style="clear: both; width: 100%"> </div>
<div style="clear: both; width: 100%">
<div style="float: left; width: 120px; text-align: left"> </div>
<div style="float: left; text-align: left"><input type="submit" name="submit" value="senden" /> <input type="reset" name="reset" value="löschen" /></div>
</div>
</div>
probiere ich auch mal, mittlerweile habe ich auch das aus dem 2. link von dir am laufen, aber checke noch nicht wo der dateiupload läufti-fekt hat geschrieben:Schau mal hier. Das funktioniert soweit schon, aber es sind noch ein paar Sachen die mir gemacht werden müssen.
einmal mit input type=file einmal type=attachment. ich komme der sache näher, der pfad ist bekannt und der name auch ...Datei temp.txt
Datei2 C:\\Dokumente und Einstellungen\\user\\Desktop\\temp.txt
Code: Alles auswählen
/////////////////////////////////////////////////
// ATTACHMENT METHODS
/////////////////////////////////////////////////
/**
* Adds an attachment from a path on the filesystem.
* Checks if attachment is valid and then adds
* the attachment to the list.
* Returns false if the file could not be found
* or accessed.
* @access public
* @return bool
*/
function AddAttachment($path, $name = "", $encoding = "base64", $type = "application/octet-stream") {
if(!@is_file($path))
{
$this->error_handler(sprintf("Could not access [%s] file", $path));
return false;
}
$filename = basename($path);
if($name == "")
$name = $filename;
// Append to $attachment array
$cur = count($this->attachment);
$this->attachment[$cur][0] = $path;
$this->attachment[$cur][1] = $filename;
$this->attachment[$cur][2] = $name;
$this->attachment[$cur][3] = $encoding;
$this->attachment[$cur][4] = $type;
$this->attachment[$cur][5] = false; // isStringAttachment
$this->attachment[$cur][6] = "attachment";
$this->attachment[$cur][7] = 0;
return true;
}
Code: Alles auswählen
<?php
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname : Contact form
* Author(s) : Andreas Lindner
* Copyright : Contenido - four for business
* Created : 12.08.2005
************************************************/
#Includes
cInclude("classes", "class.phpmailer.php");
if (!isset ($_POST['send'])) {
#Form has not been sent yet
cInclude('classes', 'class.article.php');
cInclude('classes', 'class.template.php');
#Create contact form
echo '<form name="kontaktform" id="kontaktform" method="post" action="'.$sess->url("front_content.php?idcat=$idcat&idart=$idart&parentid=$parentid").'">';
echo '<input type="hidden" name="send" value="1">';
if (!is_object($tpl)) {
$tpl = new Template;
}
$tpl->set("s", "ANREDE", mi18n("Anrede"));
$tpl->set("s", "ANREDE_OPTION1", mi18n("Herr"));
$tpl->set("s", "ANREDE_OPTION2", mi18n("Frau"));
$tpl->set("s", "NACHNAME", mi18n("Name"));
$tpl->set("s", "VORNAME", mi18n("Vorname"));
$tpl->set("s", "FIRMA", mi18n("Firma"));
$tpl->set("s", "STRASSE", mi18n("Straße/Nr."));
$tpl->set("s", "PLZORT", mi18n("PLZ/Ort"));
$tpl->set("s", "TELEFON", mi18n("Telefon"));
$tpl->set("s", "EMAIL", mi18n("eMail"));
$tpl->set("s", "ATTACH", mi18n("Anlage test"));
$tpl->set("s", "ATTACH2", mi18n("Anlage test2"));
$tpl->set("s", "ANLIEGEN", mi18n("Nachricht"));
$tpl->set("s", "PFLICHTFELDER", mi18n("Pflichtfelder"));
$tpl->set("s", "ABSCHICKEN", mi18n("Abschicken"));
$tpl->set("s", "LOESCHEN", mi18n("Löschen"));
$tpl->generate($cfgClient[$client]["path"]["frontend"]."templates/kontaktformular.html");
echo '</form>';
} elseif ($_POST['send'] == 1) {
#Form has been sent
#Check user input
$noerrors = true;
$msg = '';
if ($_POST['Vorname'] == '') {
$noerrors = false;
$msg .= mi18n("Bitte geben Sie Ihren Vornamen ein!")."<br/>";
}
if ($_POST['Nachname'] == '') {
$noerrors = false;
$msg .= mi18n("Bitte geben Sie Ihren Namen ein!")."'<br/>";
}
if ($_POST['EMail'] == '') {
$noerrors = false;
$msg .= mi18n("Bitte geben Sie Ihre EMail-Adresse ein!")."<br/>";
}
if ($_POST['Strasse'] == '') {
$noerrors = false;
$msg .= mi18n("Bitte geben Sie Ihre Straße ein!")."<br/>";
}
if ($_POST['PLZOrt'] == '') {
$noerrors = false;
$msg .= mi18n("Bitte geben Sie Ihre PLZ/Ort ein!")."<br/>";
}
if ($noerrors == false) {
#Errors have been found
echo mi18n("Beim Versenden sind folgende Fehler aufgetreten:")."<br/>";
echo $msg.'<br/>';
echo '<a href="javascript:history.back();">'.mi18n("Zurück").'</a>';
} else {
#No errors, create and send mail
$mail = new phpmailer;
$mail_body = '<html><head></head><body bgcolor="#ffffff"><table cellspacing="0" cellpadding="2" border="0">';
if (is_array($_POST)) {
foreach ($_POST as $key => $value) {
if ($key != 'send' && $key != 'Datei2' ) {
$mail_body .= "<tr><td>$key</td><td>$value</td></tr>";
}
}
}
$mail_body .= '</table></body></html>';
if (is_array($_POST)) {
foreach ($_POST as $key => $value) {
if ($key == 'Datei2' ) {
$mail_attachment = $value;
}
}
}
$mail->Host = "localhost";
$mail->IsHTML(true);
#Get mailer from settings
switch (strtolower("CMS_VALUE[4]")) {
case "smtp" :
$mail->IsSMTP();
$host = "CMS_VALUE[5]";
$user = "CMS_VALUE[6]";
$password = "CMS_VALUE[7]";
if (($host != '') && ($user != '') && ($password != '')) {
$mail-> $SMTPAuth = true;
$mail->Host = $host;
$mail->Username = $user;
$mail->Password = $password;
}
break;
case "mail" :
$mail->IsMail();
break;
case "sendmail" :
$mail->IsSendmail();
break;
case "qmail" :
$mail->IsQmail();
break;
default :
}
$mail->From = "CMS_VALUE[0]";
$mail->FromName = "CMS_VALUE[2]";
$mail->AddAddress("CMS_VALUE[1]", "");
$mail->Subject = "CMS_VALUE[3]";
$mail->attachment = $mail_attachment;
$mail->Body = $mail_body;
$mail->WordWrap = 50;
$mail->Send();
#Display message after mail is sent
echo mi18n("Ihr Anliegen wurde uns übermittelt. Vielen Dank!")."<br/>";
}
}
?>
Code: Alles auswählen
<table cellspacing="1" cellpadding="1" border="0">
<tr><td colspan="3"><span class="small"><sup>(*)</sup></span> {PFLICHTFELDER}</tr>
<tr>
<td>{ANREDE}</td><td width="20"> </td>
<td>
<input type="radio" name="Anrede" value="{ANREDE_OPTION1}" checked> {ANREDE_OPTION1}<br/>
<input type="radio" name="Anrede" value="{ANREDE_OPTION2}"/> {ANREDE_OPTION2}
</td>
</tr>
<tr><td>{VORNAME}<span class="small"><sup>(*)</sup></span></td><td width="20"> </td><td><input type="text" name="Vorname" id="Vorname" maxlength="100" style="width:240px;"/></td></tr>
<tr><td>{NACHNAME}<span class="small"><sup>(*)</sup></span></td><td width="20"> </td><td><input type="text" name="Nachname" id="Nachname" maxlength="100" style="width:240px;"/></td></tr>
<tr><td>{FIRMA}</td><td width="20"> </td><td><input type="text" name="Firma" id="Firma" maxlength="100" style="width:240px;"/></td></tr>
<tr><td>{STRASSE}<span class="small"><sup>(*)</sup></span></td><td width="20"> </td><td><input type="text" name="Strasse" id="Strasse" maxlength="100" style="width:240px;"/></td></tr>
<tr><td>{PLZORT}<span class="small"><sup>(*)</sup></span></td><td width="20"> </td><td><input type="text" name="PLZOrt" id="PLZOrt" maxlength="40" style="width:240px;"/></td></tr>
<tr><td>{TELEFON}<span class="small"><sup>(*)</sup></span></td><td width="20"> </td><td><input type="text" name="Telefon" id="Telefon" maxlength="100" style="width:240px;"/></td></tr>
<tr><td>{EMAIL}<span class="small"><sup>(*)</sup></span></td><td width="20"> </td><td><input type="text" name="EMail" id="EMail" maxlength="100" style="width:240px;"/></td></tr>
<tr><td colspan="3"> </tr>
<tr><td valign="top">{ANLIEGEN}</td><td width="20"> </td><td><textarea name="Anliegen" id="Anliegen" style="width:240px;height:170px;font-family:Verdana,Tahoma,Arial,Helvetica,Sans-serif,sans-serif;font-size:11px;"></textarea></td></tr>
<tr><td valign="top">{ATTACH}</td><td width="20"> </td><td><input type="file" id="Anlage" name="Datei" style="width:240px;"/></td></tr>
<tr><td valign="top">{ATTACH2}</td><td width="20"> </td><td><input type="attachment" id="Anlage2" name="Datei2" style="width:240px;"/></td></tr>
<tr><td colspan="3"> </tr>
<tr><td><input type="submit" value="{ABSCHICKEN}"/></td><td width="20"> </td><td align="right"><input type="reset" value="{LOESCHEN}"/></td></tr>
</table>