Modify the contact form
Modify the contact form
I have some special needs in a form...
I tried to modify the contact form going with the cmsms package - doesn't work properly. Does anyone now how to do it?
I tried to modify the contact form going with the cmsms package - doesn't work properly. Does anyone now how to do it?
Re: Modify the contact form
You forget specify what You want (I mean Your needs)
For start try read this topic:
http://forum.cmsmadesimple.org/viewtopic.php?t=469

http://forum.cmsmadesimple.org/viewtopic.php?t=469
Modify the contact form
Here are my needs:
As it is from scratch, there is name, email, subject and message as standard.
Instead of subject and message, I would like 3 inputs with the name wish1, wish2 and wish3. Finaly i would like a checkbox, which the user has to check before sending the form.
As it is from scratch, there is name, email, subject and message as standard.
Instead of subject and message, I would like 3 inputs with the name wish1, wish2 and wish3. Finaly i would like a checkbox, which the user has to check before sending the form.
Modify the contact form
That was me...
Here is what i tried...
After ending it shows the string:
- meaning that it wasn't send!
What did I do wrong?
Here is what i tried...
Code: Select all
<?php
#CMS - CMS Made Simple
#(c)2004 by Ted Kulp (wishy@users.sf.net)
#This project's homepage is: http://cmsmadesimple.sf.net
#
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
function smarty_cms_function_contact_form_mactopia($params, &$smarty) {
if (empty($params['email'])){
echo '<div class="formError">Der skal indtastes en emailadresse, før denne form kan anvendes.</div>';
exit;
}else{
$to = $params['email'];
}
$style = true;
if (!empty($params['style']))$style = $params['style'];
$name = '';
if (!empty($_POST['name'])) $name = trim($_POST['name']);
$email = '';
if (!empty($_POST['email'])) $email = trim($_POST['email']);
$subject = '';
if (!empty($_POST['subject1'])) $subject1 = trim($_POST['subject1']);
$subject = '';
if (!empty($_POST['subject2'])) $subject2 = trim($_POST['subject2']);
$subject = '';
if (!empty($_POST['subject3'])) $subject3 = trim($_POST['subject3']);
$message = '';
if (!empty($_POST['message'])) $message = trim($_POST['message']);
if($_SERVER['REQUEST_METHOD']=='POST'){
$extra = "From: $name <$email>\r\nReply-To: $email\r\n";
echo '<div class="contactMessage"';
echo ($style)?' style="font-weight: bold; color: red;"':'';
echo '>';
if (empty($name)) {
echo 'Skriv venligst dit navn.';
}elseif (empty($email)) {
echo 'Skriv venligst din emailadresse.';
}elseif (empty($subject1)) {
echo 'Skriv venligst første ønske.';
}elseif (empty($subject2)) {
echo 'Skriv venligst andet ønske..';
}elseif (empty($subject3)) {
echo 'Skriv venligst tredie ønske..';
}elseif (!validEmail($email)) {
echo 'Din emailadresse er ugyldig.';
}elseif (@mail($to, $subject1, $subject2, $subject3, $message, $extra)){
echo "Beskeden blev sendt, og du modtager snarest en bekræftigelse.</div>";
return;
}else{
echo 'Beskeden blev ikke sendt - serveren kan være nede. Prøv venligst senere!</div>';
return;
}
echo '</div>';
}
?>
<p>
<form action="<?php $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'] ?>" method="post" name="contactForm"<?php echo ($style)?' style="font-weight: bold;"':''; ?>>
Navn:
<input type="text" name="name" value="<?php echo $name; ?>" size="50"<?php echo ($style)?' style="width: 350px; border: solid 1px black; display: block; margin-bottom: 7px;"':''; ?>>
Nuværende email:
<input type="text" name="email" value="<?php echo $email; ?>" size="20"<?php echo ($style)?' style="width: 350px; border: solid 1px black; display: block; margin-bottom: 7px;"':''; ?>>
1. ønske:
<input type="text" name="subject1" value="<?php echo $subject1; ?>" size="20"<?php echo ($style)?' style="width: 350px; border: solid 1px black; display: block; margin-bottom: 7px;"':''; ?>>
2. ønske:
<input type="text" name="subject2" value="<?php echo $subject2; ?>" size="20"<?php echo ($style)?' style="width: 350px; border: solid 1px black; display: block; margin-bottom: 7px;"':''; ?>>
3. ønske:
<input type="text" name="subject3" value="<?php echo $subject3; ?>" size="20"<?php echo ($style)?' style="width: 350px; border: solid 1px black; display: block; margin-bottom: 7px;"':''; ?>>
<input type="hidden" name="message" value="<?php echo $message; ?>" size="20"<?php echo ($style)?' style="width: 350px; border: solid 1px black; display: block; margin-bottom: 7px;"':''; ?>>
<input type="submit" value="Send"><input type="reset" value="Nulstil">
</form>
</p>
<?php
}
function smarty_cms_help_function_contact_form() {
?>
<h3>What does this do?</h3>
<p>Display's a contact form. This can be used to allow others to send an email message to the address specified.</p>
<h3>How do I use it?</h3>
<p>Just insert the tag into your template/page like: <code>{contact_form email="email@email.dk"}</code><br>
<br>
If you would like to send an email to multiple adresses, seperate each address with a comma.</p>
<h3>What parameters does it take?</h3>
<ul>
<li>email - The email address that the message will be sent to.</li>
<li><em>(optional)</em>style - true/false, use the predefined styles. Default is true.</li>
</ul>
</p>
<?php
}
function smarty_cms_about_function_contact_form() {
?>
<p>Author: Brett Batie<brett-cms@provisiontech.net></p>
<p>Version: 1.0</p>
<p>
Change History:<br/>
None
</p>
<?php
}
function validEmail($email) {
if (!preg_match("/^([\w|\.|\-|_]+)@([\w||\-|_]+)\.([\w|\.|\-|_]+)$/i", $email)) {
return false;
exit;
}
return true;
}
?>
Code: Select all
Beskeden blev ikke sendt - serveren kan være nede. Prøv venligst senere!
What did I do wrong?
Modify the contact form
Here is correct code:
I was change 3 things:
1.
You use wrong parameters at line with calling function mail() - check its prototype at
http://www.php.net/manual/en/function.mail.php
2.
I was change function names for 'help' and 'about' callback, so output of both of them can be properly displayed in plugin manager.
3.
I was change code for include (in _help_ function)
You have to make Your own process for posted data (I just bind they into one string) - I mean some headers, end of lines "\n" and more - You can succesfully use tabelators also - "\t". Note: if You want to use special characters like 'new line' and 'tabelator' - "\n" and "\t", You have to use double quoted strings - single quote will not work.
Code: Select all
<?php
#CMS - CMS Made Simple
#(c)2004 by Ted Kulp (wishy@users.sf.net)
#This project's homepage is: http://cmsmadesimple.sf.net
#
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
function smarty_cms_function_contact_form_mactopia($params, &$smarty) {
if (empty($params['email'])){
echo '<div class="formError">Der skal indtastes en emailadresse, før denne form kan anvendes.</div>';
exit;
}else{
$to = $params['email'];
}
$style = true;
if (!empty($params['style']))$style = $params['style'];
$name = '';
if (!empty($_POST['name'])) $name = trim($_POST['name']);
$email = '';
if (!empty($_POST['email'])) $email = trim($_POST['email']);
$subject = '';
if (!empty($_POST['subject1'])) $subject1 = trim($_POST['subject1']);
$subject = '';
if (!empty($_POST['subject2'])) $subject2 = trim($_POST['subject2']);
$subject = '';
if (!empty($_POST['subject3'])) $subject3 = trim($_POST['subject3']);
$message = '';
if (!empty($_POST['message'])) $message = trim($_POST['message']);
if($_SERVER['REQUEST_METHOD']=='POST'){
$extra = "From: $name <$email>\r\nReply-To: $email\r\n";
echo '<div class="contactMessage"';
echo ($style)?' style="font-weight: bold; color: red;"':'';
echo '>';
if (empty($name)) {
echo 'Skriv venligst dit navn.';
}elseif (empty($email)) {
echo 'Skriv venligst din emailadresse.';
}elseif (empty($subject1)) {
echo 'Skriv venligst første ønske.';
}elseif (empty($subject2)) {
echo 'Skriv venligst andet ønske..';
}elseif (empty($subject3)) {
echo 'Skriv venligst tredie ønske..';
}elseif (!validEmail($email)) {
echo 'Din emailadresse er ugyldig.';
// BAD PARAMETERS
// }elseif (@mail($to, $subject1, $subject2, $subject3, $message, $extra)){
}elseif (@mail($to, $name, $subject1 . " - " . $subject2 . " - " . $subject3 . " - " . $message, $extra)){
echo "Beskeden blev sendt, og du modtager snarest en bekræftigelse.</div>";
return;
}else{
echo 'Beskeden blev ikke sendt - serveren kan være nede. Prøv venligst senere!</div>';
return;
}
echo '</div>';
}
?>
<p>
<form action="<?php $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'] ?>" method="post" name="contactForm"<?php echo ($style)?' style="font-weight: bold;"':''; ?>>
Navn:
<input type="text" name="name" value="<?php echo $name; ?>" size="50"<?php echo ($style)?' style="width: 350px; border: solid 1px black; display: block; margin-bottom: 7px;"':''; ?>>
Nuværende email:
<input type="text" name="email" value="<?php echo $email; ?>" size="20"<?php echo ($style)?' style="width: 350px; border: solid 1px black; display: block; margin-bottom: 7px;"':''; ?>>
1. ønske:
<input type="text" name="subject1" value="<?php echo $subject1; ?>" size="20"<?php echo ($style)?' style="width: 350px; border: solid 1px black; display: block; margin-bottom: 7px;"':''; ?>>
2. ønske:
<input type="text" name="subject2" value="<?php echo $subject2; ?>" size="20"<?php echo ($style)?' style="width: 350px; border: solid 1px black; display: block; margin-bottom: 7px;"':''; ?>>
3. ønske:
<input type="text" name="subject3" value="<?php echo $subject3; ?>" size="20"<?php echo ($style)?' style="width: 350px; border: solid 1px black; display: block; margin-bottom: 7px;"':''; ?>>
<input type="hidden" name="message" value="<?php echo $message; ?>" size="20"<?php echo ($style)?' style="width: 350px; border: solid 1px black; display: block; margin-bottom: 7px;"':''; ?>>
<input type="submit" value="Send"><input type="reset" value="Nulstil">
</form>
</p>
<?php
}
function smarty_cms_help_function_contact_form_mactopia() {
?>
<h3>What does this do?</h3>
<p>Display's a contact form. This can be used to allow others to send an email message to the address specified.</p>
<h3>How do I use it?</h3>
<p>Just insert the tag into your template/page like: <code>{contact_form_mactopia email="email@email.dk"}</code><br>
<br>
If you would like to send an email to multiple adresses, seperate each address with a comma.</p>
<h3>What parameters does it take?</h3>
<ul>
<li>email - The email address that the message will be sent to.</li>
<li><em>(optional)</em>style - true/false, use the predefined styles. Default is true.</li>
</ul>
</p>
<?php
}
function smarty_cms_about_function_contact_form_mactopia() {
?>
<p>Author: Brett Batie<brett-cms@provisiontech.net></p>
<p>Version: 1.0</p>
<p>
Change History:<br/>
None
</p>
<?php
}
function validEmail($email) {
if (!preg_match("/^([\w|\.|\-|_]+)@([\w||\-|_]+)\.([\w|\.|\-|_]+)$/i", $email)) {
return false;
exit;
}
return true;
}
?>
1.
You use wrong parameters at line with calling function mail() - check its prototype at
http://www.php.net/manual/en/function.mail.php
2.
I was change function names for 'help' and 'about' callback, so output of both of them can be properly displayed in plugin manager.
3.
I was change code for include (in _help_ function)
You have to make Your own process for posted data (I just bind they into one string) - I mean some headers, end of lines "\n" and more - You can succesfully use tabelators also - "\t". Note: if You want to use special characters like 'new line' and 'tabelator' - "\n" and "\t", You have to use double quoted strings - single quote will not work.
Modify the contact form
Hmmm... It still doesn't work. When trying to enter the plugin management site, it displays this:
Code: Select all
Parse error: parse error, unexpected T_STRING in /home/virtual/mrbs.dk/public_html/cms/plugins/function.contact_form_mactopia.php on line 21
Modify the contact form
mrbs wrote:Hmmm... It still doesn't work. When trying to enter the plugin management site, it displays this:
Code: Select all
Parse error: parse error, unexpected T_STRING in /home/virtual/mrbs.dk/public_html/cms/plugins/function.contact_form_mactopia.php on line 21

Are You sure, You copy all code into Your clipboard?

OK, return to Your previous version of this plugin and change line with call of function mail() as I recommend. Other changes are not important for functionality, they are 'cosmetic' only. And so, in code is variable $subject initialized 3x, but $subject1..3 0x...

You know what? It will be useful for mee too (include checkbox 'I agree'), tomorrow i will create my own plugin an I will post it here.

I was trying this right now, and it works fine... I was:
- create file /plugins/function.contact_form_mactopia.php
- copy code from forum into clipboard and paste this code into file
- enter to plugin management (no errors)
- insert code {contact_form_mactopia email="anybody@anywhere.org"} into content page
- and test seems OK - I was receive email from this contact form
Modify the contact form
I did exactely what you did:
This is the message:
What is the t_string?
This is the message:
Code: Select all
Parse error: parse error, unexpected T_STRING in /home/virtual/mrbs.dk/public_html/cms/plugins/function.contact_form_mactopia.php on line 21
Modify the contact form
Hi!
Here is functional solution for contact form with 'agree' checkbox and possibility of upload file - You can do with this code whatever You want - if You don't require any parameter, just comment out proper lines - as I did with parameter cf_msg_part2 .
Just create file 'function.contact_form_attachment.php' and enjoy!
Cheers, 100rk.
P.S. : Uploaded files will be saved in Your uploads directory and sended with e-mail as attachment.
Here is functional solution for contact form with 'agree' checkbox and possibility of upload file - You can do with this code whatever You want - if You don't require any parameter, just comment out proper lines - as I did with parameter cf_msg_part2 .
Code: Select all
<?php
#CMS - CMS Made Simple
#(c)2004 by Ted Kulp (wishy@users.sf.net)
#This project's homepage is: http://cmsmadesimple.sf.net
#
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
function smarty_cms_function_contact_form_attachment($params, &$smarty) {
global $gCms;
if (empty($params['email'])) {
echo "Missing parameter 'email' - check plugin call";
return;
}
if (isset($_POST["cf_submit"])) {
$err = '';
$to = $params['email'];
$email = '';
if (!empty($_POST['cf_email'])) {
$email = trim($_POST['cf_email']);
if (!sendmail::Validate_email($email)) $err .= '<li>Wrong format of e-mail adress!</li>';
}
else $err .= '<li>Where is Your e-mail?</li>';
$name = '';
if (!empty($_POST['cf_name'])) $name = trim($_POST['cf_name']);
else $err .= '<li>Where is Your name?</li>';
$subject = '';
if (!empty($_POST['cf_subject'])) $subject = trim($_POST['cf_subject']);
else $err .= '<li>Where is subject of Your message?</li>';
$msg_part1 = '';
if (!empty($_POST['cf_msg_part1'])) $msg_part1 = trim($_POST['cf_msg_part1']);
else $err .= '<li>Where is part_1 of Your message?</li>';
$msg_part2 = '';
if (!empty($_POST['cf_msg_part2'])) $msg_part2 = trim($_POST['cf_msg_part2']);
// else $err .= '<li>Where is part_2 of Your message?</li>';
$msg_part3 = '';
if (!empty($_POST['cf_msg_part3'])) $msg_part3 = trim($_POST['cf_msg_part3']);
else $err .= '<li>Where is part_3 of Your message?</li>';
$file_name = '';
if (!empty($_FILES['cf_file'])) {
$file_name = "_cf_".$_FILES['cf_file']['name'];
$dest_file = $gCms->config["uploads_path"]."/".$file_name;
$try = 0;
while (file_exists($dest_file)) {
$file_name = $try."_cf_".$_FILES['cf_file']['name'];
$dest_file = $gCms->config["uploads_path"]."/".$file_name;
$try++;
}
$file_name = $dest_file;
if (!move_uploaded_file($_FILES['cf_file']['tmp_name'], $file_name)) {
$err .= "<li>Cannot move uploaded file to upload destination.</li>";
}
}
if (!empty($file_name)) {
if (($_FILES['cf_file']['error'])>0){
$err .= '<li>File is larger then limit 100kB, or there is other error with upload.</li>';
}
}
else $err .= '<li>Where is Your file?</li>';
if (empty($err)) {
$message_body = "Message part 1: ".$msg_part1;
$message_body .= ", message part 2: ".$msg_part2;
$message_body .= ", message part 3: ".$msg_part3;
$sendmail = new sendmail();
$sendmail->SetCharSet("ISO-8859-1");
$sendmail->from($name,$email);
$sendmail->to($to);
$sendmail->subject($subject);
$sendmail->text($message_body);
if (!empty($file_name)) $sendmail->attachment($file_name);
if ($sendmail->send()) {
echo '<div class="contactForm">';
echo 'Thank You for Your message.';
echo '</div>';
}
else echo '<ul class="error">Problem with sending e-mail message.</ul>';
return;
}
else {
echo '<ul class="error">'.$err.'</ul>';
}
}
echo '<div class="contactForm">';
echo '<form action="'.$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'].'" method="post" enctype="multipart/form-data">';
echo '<input type="hidden" name="MAX_FILE_SIZE" value="100000">';
echo '<p>Your name</p>';
echo '<input type="text" name="cf_name" value="'.$name.'" size="50">';
echo '<p>Your e-mail</p>';
echo '<input type="text" name="cf_email" value="'.$email.'" size="50">';
echo '<p>Subject</p>';
echo '<input type="text" name="cf_subject" value="'.$subject.'" size="50">';
echo '<p>part_1 of message</p>';
echo '<input type="text" name="cf_msg_part1" value="'.$msg_part1.'" size="50">';
echo '<p>part_2 of message</p>';
echo '<input type="text" name="cf_msg_part2" value="'.$msg_part2.'" size="50">';
echo '<p>part_3 of message</p>';
echo '<textarea name="cf_msg_part3" cols="50" rows="10">'.$msg_part3.'</textarea>';
echo '<p>file for upload</p>';
echo '<input type="file" name="cf_file">';
echo '<p>';
echo "<input type=\"checkbox\" onclick=\"document.getElementById('cf_submit').disabled=!document.getElementById('cf_submit').disabled;\"> ";
echo 'YES, I agree with BLABLABLABLA</p>';
echo '<input type="submit" id="cf_submit" name="cf_submit" value="SEND" disabled>';
echo '</form>';
echo '</div>';
}
function smarty_cms_help_function_contact_form_attachment() {
?>
<h3>What does this do?</h3>
<p>Simple contact form with attachment. This can be used to allow others to send
an email message to the address specified.</p>
<h3>How do I use it?</h3>
<p>Just insert the tag into your template/page like: <code>{contact_form_attachment email="anybody@anywhere.org"}</code></p>
<h3>What parameters does it take?</h3>
<ul>
<li>email - The email address that the message will be sent to.</li>
</ul>
</p>
<?php
}
function smarty_cms_about_function_contact_form_attachment() {
?>
<p>Version: 1.0</p>
<?php
}
class sendmail {
var $emailheader = "";
var $textheader = "";
var $textboundary = "";
var $emailboundary = "";
var $charset = "";
var $emailsubject = "";
var $emailto = "";
var $attachment = array();
var $cc = array();
var $bcc = array();
function sendmail() {
$this->textboundary = uniqid(time());
$this->emailboundary = uniqid(time());
$this->charset = "ISO-8859-1";
}
function SetCharSet($char) {
$this->charset = $char;
}
function Validate_email($email) {
if (!preg_match("/[a-z0-9_-]+(\.[a-z0-9_-]+)*@([0-9a-z][0-9a-z-]*[0-9a-z]\.)+([a-z]{2,4})/i",$email)) {
return false;
}
return $email;
}
function from($name,$email) {
$this->emailheader .= 'From: '.$name.'<'.$email.'>'."\r\n";
}
function to($to) {
$this->emailto = $this->Validate_email($to);
}
function cc($cc) {
$this->cc[] = $cc;
}
function bcc($bcc) {
$this->bcc[] = $bcc;
}
function makeMimeMail() {
if(count($this->cc) > 0) {
$this->emailheader .= 'Cc: ';
for($i=0;$i<count($this->cc);$i++) {
if($i > 0) $this->emailheader .= ',';
$this->emailheader .= $this->Validate_email($this->cc[$i]);
}
$this->emailheader .= "\r\n";
}
if(count($this->bcc) > 0) {
$this->emailheader .= 'Bcc: ';
for($j=0;$j<count($this->bcc);$j++) {
if($j > 0) $this->emailheader .= ',';
$this->emailheader .= $this->Validate_email($this->bcc[$j]);
}
$this->emailheader .= "\r\n";
}
$this->emailheader .= 'MIME-Version: 1.0'."\r\n";
}
function subject($subject) {
$this->emailsubject = $subject;
}
function text($text) {
$this->textheader .= 'Content-Type: multipart/alternative; boundary="'.$this->textboundary.'"'."\r\n\r\n";
$this->textheader .= '--'.$this->textboundary."\r\n";
$this->textheader .= 'Content-Type: text/plain; charset="'.$this->charset.'"'."\r\n";
$this->textheader .= 'Content-Transfer-Encoding: quoted-printable'."\r\n\r\n";
$this->textheader .= strip_tags($text)."\r\n\r\n";
$this->textheader .= '--'.$this->textboundary."\r\n";
$this->textheader .= 'Content-Type: text/html; charset="'.$this->charset.'"'."\r\n";
$this->textheader .= 'Content-Transfer-Encoding: quoted-printable'."\r\n\r\n";
$this->textheader .= '<__html></__body>'.$text.'<__body></__html>'."\r\n\r\n";
$this->textheader .= '--'.$this->textboundary.'--'."\r\n\r\n";
}
function attachment($attachfile) {
if(is_file($attachfile)) {
$attachment_header = '--'.$this->emailboundary."\r\n" ;
$attachment_header .= 'Content-Type: application/octet-stream; name="'.basename($attachfile).'"'."\r\n";
$attachment_header .= 'Content-Transfer-Encoding: base64'."\r\n";
$attachment_header .= 'Content-Disposition: attachment; filename="'.basename($attachfile).'"'."\r\n\r\n";
$file['content'] = fread(fopen($attachfile,"rb"),filesize($attachfile));
$file['content'] = base64_encode($file['content']);
$file['content'] = chunk_split($file['content'],72);
$this->attachment[] = $attachment_header.$file['content']."\r\n";
}
else {
die("File doesn't exist'!");
}
}
function send() {
$this->makeMimeMail();
$header = $this->emailheader;
if(count($this->attachment)>0) {
$header .= 'Content-Type: multipart/mixed; boundary="'.$this->emailboundary.'"'."\r\n\r\n";
$header .= '--'.$this->emailboundary."\r\n";
$header .= $this->textheader;
if(count($this->attachment) > 0) $header .= implode("",$this->attachment);
$header .= '--'.$this->emailboundary.'--';
}
else {
$header .= $this->textheader;
}
$result = mail("$this->emailto",$this->emailsubject,"",$header);
$this->deletememory();
return $result;
}
function deletememory() {
unset($this->emailheader);
unset($this->textheader);
unset($this->attachment);
}
}
?>
Cheers, 100rk.
P.S. : Uploaded files will be saved in Your uploads directory and sended with e-mail as attachment.
Re: Hi
Hmmm... I am using 0.8.2 also and here it works fine... You know what? Try download this plugin fromIndrek wrote:I tried to use your code, but when i entered the file function.contact_form_attachment.php with code in /plugins/ catalog then my plugin managament and webpage stopps working (shows empty page).
I am using cmsmadesimple version 0.8.2. (do i need 0.9?).
Thanks.
http://www.100rk.org/fortry/function.co ... nt.php.zip
unpack it and put it in plugins directory - maybe there is some error with copying code from HTML page of this forum by clipboard... If it will not help, delete this file, display Your plugin management page, then copy this file into /plugins directory and reload Your admin page. Then display source code of this 'empty' page and send me a packed copy by e-mail. I don't believe there will not be any character in this 'empty' page source and it helps me find out reason of this problem.
Hi
I did as you said, but after refresh comes empty page with empty source code as all other pages in my website
http://www.balti.ee/proov/index.php?page=Kontakt
Maybe it helps when I reinstall my CMS?
http://www.balti.ee/proov/index.php?page=Kontakt
Maybe it helps when I reinstall my CMS?
Re: Hi
No, reinstall CMS will not help, it is not windowsIndrek wrote:I did as you said, but after refresh comes empty page with empty source code as all other pages in my website
http://www.balti.ee/proov/index.php?page=Kontakt
Maybe it helps when I reinstall my CMS?

Remove this plugin and leave Your pages untouched, I will take look at it. Also please create file phpinfo.php with content
Code: Select all
<?php
phpinfo();
?>
Re: Hi
I am so sorry - forgot about it and take a look here:
http://wiki.cmsmadesimple.org/pmwiki.ph ... tedModules
and try module 'FeedbackForm' - with all Your needs it will be good point.
http://wiki.cmsmadesimple.org/pmwiki.ph ... tedModules
and try module 'FeedbackForm' - with all Your needs it will be good point.