F
fercules
dieses script sendet ein formular mit anhang als email. leider kann man bisher nur eine datei damit abschicken. was müsste man tun, damit man mit diesem script z.b. 5 statt 1 upload gleichzeitig machen könnte? hab schon einges erfolglos probiert und langsam keinen nerv mehr
<?php
$websitename="phMailer 1.3"; //Website Name
$allowtypes=array("zip", "rar", "txt", "doc", "jpg", "jpeg", "png", "gif", "ai", "bmp", "tiff", "tif", "pdf", "eps", "psd", "psp");
$myemail="you@yourdomain.com"; // What's your email address?
$priority="3"; // What priority should I send the mail? 1 is Urgent, 10 Is low. 3 Is default.
$allowattach="1"; // Should we allow visitors to attach *.zip files? 1=yes, 0=no.
$submitvalue=" Send Email "; // Value for the Submit Button
$resetvalue=" Reset Form "; // Value for the Reset Button
$defaultsubject="No Subject"; // Default subject header? This will be sent if the user does not specify a subject.
$thanksmessage="Thank you! Your email has been sent, we will respond shortly."; //Your thank you message, displays after the email has been sent.
$twidth="450"; // Table Width
$tableborder="1"; // Show table border? 1=yes, 0=no.
$tbordercolor="#000000"; // Table Border Color
$thead="#FFFFFF"; // Table head background Color
$tbody="#FFFFFF"; // Table Body Background Color
$bgcolor="#FFFFF"; // Page bg Color
$fontface="Verdana,Arial"; // Font face
$fonthead="#000000"; // Font Head Color
$fontheadsize="11"; // Font Head Size
$fontbody="#000000"; // Font BodyColor
$fontbodysize="10"; // Font Body Size
/*
//================================================================================
* Attention
//================================================================================
: Don't edit below this line unless you know some php. Editing some variables or other stuff could cause undeseriable results
*/
function get_ext($key) {
return(strtolower(substr(strrchr($key, "."), 1)));
}
If($_POST['domail']) {
extract($_POST);
If($allowattach) {
$attachment=$_FILES['attachment']['tmp_name'];
$attachment_type=$_FILES['attachment']['type'];
}
If ($yourname=="") {
$error = "1";
$error_text .= "You did not enter your name!<br />";
}
If ($youremail=="") {
$error = "1";
$error_text .= "You did not enter your email!<br />";
}
If($emailsubject=="") {
$emailsubject=$defaultsubject;
}
If ($youremail) {
If (!eregi("^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}\$",$youremail)){
$error = "1";
$error_text .= "Invalid Email Address!<br />";
}
}
If ($yourmessage=="") {
$error = "1";
$error_text .= "You did not enter a message!<br />";
}
If($allowattach) {
foreach($allowtypes as $it) {
$types .="*.".$it.",";
}
If($attachment) {
$ext=get_ext($_FILES[attachment][name]);
If(!in_array($ext, $allowtypes)) {
$error = "1";
$error_text .= "Invalid extension for your attchment, only ".$types." are allowed!<br />";
}
}
}
If($error=="1") {
$disperrors=$error_text;
} Else {
$headers = "From: ".$yourname." <".$youremail.">\n";
$headers .= "Reply-To: ".$yourname." <".$youremail.">\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"MIME_BOUNDRY\"\n";
$headers .= "X-Sender: ".$_SERVER['REMOTE_ADDR']."\n";
$headers .= "X-Mailer: phMailerv1.3\n";
$headers .= "X-Priority: ".$priority."\n";
$headers .= "Return-Path: <".$myemail.">\n";
$headers .= "This is a multi-part message in MIME format.\n";
If($allowattach) {
If($attachment) {
$fp=@fopen($attachment,"r");
$str=@fread($fp, filesize($attachment));
$str=@chunk_split(base64_encode($str));
}
}
$message = "--MIME_BOUNDRY\n";
$message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
$message .= "Content-Transfer-Encoding: quoted-printable\n";
$message .= "\n";
$message .= "$yourmessage";
$message .= "\n";
If($allowattach) {
If($attachment) {
$message .= "--MIME_BOUNDRY\n";
$message .= "Content-Type: application/octet-stream; name=\"" . $_FILES['attachment']['name'] . "\"\n";
$message .= "Content-disposition: attachment\n";
$message .= "Content-Transfer-Encoding: base64\n";
$message .= "\n";
$message .= "$str\n";
$message .= "\n";
$message .= "--MIME_BOUNDRY--\n";
}
}
If(!mail($myemail,$emailsubject,$message,$headers)) {
exit("There has been an error, please contact the admin");
}
Echo("<div align=\"center\">".$thanksmessage."</div>");
exit(cp());
}
}
//Please do not remove, I worked hard on this script!
.
function cp() {
Echo("<br /><br /><div align=\"center\" class=\"body\">Powered By: <a href=\"http://www.phphq.net?script=phMailer\" target=\"_blank\"><b>phMailer v1.3</b></a></div>\n");
}
/*
//================================================================================
* Start the form layout
//================================================================================
:- Start the form, if you are editing this form, please remember to escape all quotes " with a backslash, an example would be <input type=\"text\">
:- If you do not do this, you will get phrase errors.
:- Also, please remember that if you change values in this form, the script may not work how it was originally meant to.
*/
Echo("<html>\n");
Echo("<head>\n");
Echo("<title>".$websitename." - Powered By phMailer v1.3</title>\n");
Echo("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\" />\n");
Echo("<style type=\"text/css\">\n");
Echo("body{background-color:".$bgcolor.";}\n");
Echo("a:link {text-decoration:none; color:".$fontbody.";}\n");
Echo("a:visited {text-decoration:none; color:".$fontbody.";}\n");
Echo(".head{font-family:".$fontface."; font-size:".$fontheadsize."; color:".$fonthead."; font-weight:bold;}\n");
Echo(".body{font-family:".$fontface."; font-size:".$fontbodysize."; color:".$fontbody.";}\n");
Echo("input { font-family:".$fontface."; font-size:".$fontbodysize."px; color:".$fonthead."; border:1px solid ".$tbordercolor."; background-color:".$thead.";}\n");
Echo("</style>\n");
Echo("</head>\n");
Echo("<body>\n");
Echo("<div align=\"center\" class=\"body\"><b>".$disperrors."</b></div>");
Echo("<form method=\"POST\" action=\"".$_SERVER['PHP_SELF']."\""); If($allowattach){Echo(" enctype=\"multipart/form-data\"");}Echo(">\n");
Echo("<table cellspacing=\"0\" cellpadding=\"1\" border=\"".$tborder."\" style=\"border-collapse: collapse\" bordercolor=\"".$tbordercolor."\" align=\"center\" width=\"".$twidth."\" bgcolor=\"".$tbody."\" class=\"body\">\n");
Echo("<tr>\n");
Echo("<td colspan=\"2\" align=\"center\" bgcolor=\"".$thead."\" class=\"head\">".$websitename."</td>\n");
Echo("</tr>\n");
Echo("<tr>\n");
Echo("<td width=\"30%\" >Your Name:</td>\n");
Echo("<td width=\"70%\"><input name=\"yourname\" type=\"text\" size=\"30\" value=\"".stripslashes($yourname)."\" /></td>\n");
Echo("</tr>\n");
Echo("<tr>\n");
Echo("<td width=\"30%\">Your Email:</td>\n");
Echo("<td width=\"70%\"><input name=\"youremail\" type=\"text\" size=\"30\" value=\"".stripslashes($youremail)."\" /></td>\n");
Echo("</tr>\n");
Echo("<tr>\n");
Echo("<td width=\"30%\" >Email Subject:</td>\n");
Echo("<td width=\"70%\"><input name=\"emailsubject\" type=\"text\" size=\"30\" value=\"".stripslashes($emailsubject)."\" /></td>\n");
Echo("</tr>\n");
If($allowattach) {
Echo("<tr>\n");
Echo("<td width=\"30%\">Attachment:</td>\n");
Echo("<td width=\"70%\"><input name=\"attachment\" type=\"file\" size=\"30\" /></td>\n");
Echo("</tr>\n");
}
Echo("<tr>\n");
Echo("<td colspan=\"2\">Your Message:<br />\n");
Echo("<textarea name=\"yourmessage\" rows=\"8\" cols=\"100%\">".stripslashes($yourmessage)."</textarea></td>\n");
Echo("</tr>\n");
Echo("<tr bgcolor=\"".$thead."\">\n");
Echo("<td colspan=\"2\" align=\"center\"><input name=\"domail\" type=\"submit\" value=\"".$submitvalue."\" /> <input type=\"reset\" value=\"".$resetvalue."\" /></td>\n");
Echo("</tr>\n");
Echo("</table>\n");
cp();
Echo("</body>\n");
Echo("</html>\n");
?>
lg
stephan
<?php
$websitename="phMailer 1.3"; //Website Name
$allowtypes=array("zip", "rar", "txt", "doc", "jpg", "jpeg", "png", "gif", "ai", "bmp", "tiff", "tif", "pdf", "eps", "psd", "psp");
$myemail="you@yourdomain.com"; // What's your email address?
$priority="3"; // What priority should I send the mail? 1 is Urgent, 10 Is low. 3 Is default.
$allowattach="1"; // Should we allow visitors to attach *.zip files? 1=yes, 0=no.
$submitvalue=" Send Email "; // Value for the Submit Button
$resetvalue=" Reset Form "; // Value for the Reset Button
$defaultsubject="No Subject"; // Default subject header? This will be sent if the user does not specify a subject.
$thanksmessage="Thank you! Your email has been sent, we will respond shortly."; //Your thank you message, displays after the email has been sent.
$twidth="450"; // Table Width
$tableborder="1"; // Show table border? 1=yes, 0=no.
$tbordercolor="#000000"; // Table Border Color
$thead="#FFFFFF"; // Table head background Color
$tbody="#FFFFFF"; // Table Body Background Color
$bgcolor="#FFFFF"; // Page bg Color
$fontface="Verdana,Arial"; // Font face
$fonthead="#000000"; // Font Head Color
$fontheadsize="11"; // Font Head Size
$fontbody="#000000"; // Font BodyColor
$fontbodysize="10"; // Font Body Size
/*
//================================================================================
* Attention
//================================================================================
: Don't edit below this line unless you know some php. Editing some variables or other stuff could cause undeseriable results
*/
function get_ext($key) {
return(strtolower(substr(strrchr($key, "."), 1)));
}
If($_POST['domail']) {
extract($_POST);
If($allowattach) {
$attachment=$_FILES['attachment']['tmp_name'];
$attachment_type=$_FILES['attachment']['type'];
}
If ($yourname=="") {
$error = "1";
$error_text .= "You did not enter your name!<br />";
}
If ($youremail=="") {
$error = "1";
$error_text .= "You did not enter your email!<br />";
}
If($emailsubject=="") {
$emailsubject=$defaultsubject;
}
If ($youremail) {
If (!eregi("^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}\$",$youremail)){
$error = "1";
$error_text .= "Invalid Email Address!<br />";
}
}
If ($yourmessage=="") {
$error = "1";
$error_text .= "You did not enter a message!<br />";
}
If($allowattach) {
foreach($allowtypes as $it) {
$types .="*.".$it.",";
}
If($attachment) {
$ext=get_ext($_FILES[attachment][name]);
If(!in_array($ext, $allowtypes)) {
$error = "1";
$error_text .= "Invalid extension for your attchment, only ".$types." are allowed!<br />";
}
}
}
If($error=="1") {
$disperrors=$error_text;
} Else {
$headers = "From: ".$yourname." <".$youremail.">\n";
$headers .= "Reply-To: ".$yourname." <".$youremail.">\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"MIME_BOUNDRY\"\n";
$headers .= "X-Sender: ".$_SERVER['REMOTE_ADDR']."\n";
$headers .= "X-Mailer: phMailerv1.3\n";
$headers .= "X-Priority: ".$priority."\n";
$headers .= "Return-Path: <".$myemail.">\n";
$headers .= "This is a multi-part message in MIME format.\n";
If($allowattach) {
If($attachment) {
$fp=@fopen($attachment,"r");
$str=@fread($fp, filesize($attachment));
$str=@chunk_split(base64_encode($str));
}
}
$message = "--MIME_BOUNDRY\n";
$message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
$message .= "Content-Transfer-Encoding: quoted-printable\n";
$message .= "\n";
$message .= "$yourmessage";
$message .= "\n";
If($allowattach) {
If($attachment) {
$message .= "--MIME_BOUNDRY\n";
$message .= "Content-Type: application/octet-stream; name=\"" . $_FILES['attachment']['name'] . "\"\n";
$message .= "Content-disposition: attachment\n";
$message .= "Content-Transfer-Encoding: base64\n";
$message .= "\n";
$message .= "$str\n";
$message .= "\n";
$message .= "--MIME_BOUNDRY--\n";
}
}
If(!mail($myemail,$emailsubject,$message,$headers)) {
exit("There has been an error, please contact the admin");
}
Echo("<div align=\"center\">".$thanksmessage."</div>");
exit(cp());
}
}
//Please do not remove, I worked hard on this script!

function cp() {
Echo("<br /><br /><div align=\"center\" class=\"body\">Powered By: <a href=\"http://www.phphq.net?script=phMailer\" target=\"_blank\"><b>phMailer v1.3</b></a></div>\n");
}
/*
//================================================================================
* Start the form layout
//================================================================================
:- Start the form, if you are editing this form, please remember to escape all quotes " with a backslash, an example would be <input type=\"text\">
:- If you do not do this, you will get phrase errors.
:- Also, please remember that if you change values in this form, the script may not work how it was originally meant to.
*/
Echo("<html>\n");
Echo("<head>\n");
Echo("<title>".$websitename." - Powered By phMailer v1.3</title>\n");
Echo("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\" />\n");
Echo("<style type=\"text/css\">\n");
Echo("body{background-color:".$bgcolor.";}\n");
Echo("a:link {text-decoration:none; color:".$fontbody.";}\n");
Echo("a:visited {text-decoration:none; color:".$fontbody.";}\n");
Echo(".head{font-family:".$fontface."; font-size:".$fontheadsize."; color:".$fonthead."; font-weight:bold;}\n");
Echo(".body{font-family:".$fontface."; font-size:".$fontbodysize."; color:".$fontbody.";}\n");
Echo("input { font-family:".$fontface."; font-size:".$fontbodysize."px; color:".$fonthead."; border:1px solid ".$tbordercolor."; background-color:".$thead.";}\n");
Echo("</style>\n");
Echo("</head>\n");
Echo("<body>\n");
Echo("<div align=\"center\" class=\"body\"><b>".$disperrors."</b></div>");
Echo("<form method=\"POST\" action=\"".$_SERVER['PHP_SELF']."\""); If($allowattach){Echo(" enctype=\"multipart/form-data\"");}Echo(">\n");
Echo("<table cellspacing=\"0\" cellpadding=\"1\" border=\"".$tborder."\" style=\"border-collapse: collapse\" bordercolor=\"".$tbordercolor."\" align=\"center\" width=\"".$twidth."\" bgcolor=\"".$tbody."\" class=\"body\">\n");
Echo("<tr>\n");
Echo("<td colspan=\"2\" align=\"center\" bgcolor=\"".$thead."\" class=\"head\">".$websitename."</td>\n");
Echo("</tr>\n");
Echo("<tr>\n");
Echo("<td width=\"30%\" >Your Name:</td>\n");
Echo("<td width=\"70%\"><input name=\"yourname\" type=\"text\" size=\"30\" value=\"".stripslashes($yourname)."\" /></td>\n");
Echo("</tr>\n");
Echo("<tr>\n");
Echo("<td width=\"30%\">Your Email:</td>\n");
Echo("<td width=\"70%\"><input name=\"youremail\" type=\"text\" size=\"30\" value=\"".stripslashes($youremail)."\" /></td>\n");
Echo("</tr>\n");
Echo("<tr>\n");
Echo("<td width=\"30%\" >Email Subject:</td>\n");
Echo("<td width=\"70%\"><input name=\"emailsubject\" type=\"text\" size=\"30\" value=\"".stripslashes($emailsubject)."\" /></td>\n");
Echo("</tr>\n");
If($allowattach) {
Echo("<tr>\n");
Echo("<td width=\"30%\">Attachment:</td>\n");
Echo("<td width=\"70%\"><input name=\"attachment\" type=\"file\" size=\"30\" /></td>\n");
Echo("</tr>\n");
}
Echo("<tr>\n");
Echo("<td colspan=\"2\">Your Message:<br />\n");
Echo("<textarea name=\"yourmessage\" rows=\"8\" cols=\"100%\">".stripslashes($yourmessage)."</textarea></td>\n");
Echo("</tr>\n");
Echo("<tr bgcolor=\"".$thead."\">\n");
Echo("<td colspan=\"2\" align=\"center\"><input name=\"domail\" type=\"submit\" value=\"".$submitvalue."\" /> <input type=\"reset\" value=\"".$resetvalue."\" /></td>\n");
Echo("</tr>\n");
Echo("</table>\n");
cp();
Echo("</body>\n");
Echo("</html>\n");
?>
lg
stephan