Page 1 of 1

I f* my mom's website, and I can't fix it. (cgi/contact form

Posted: Tue Sep 05, 2006 1:04 am
by Leonardo
My mom's website is a combination of a very old flash anymation and a even older html site.

I pretty much did the whole mess (website) myself, execpt for one thing.... the contact form.

The contact form was done by somebody (who I won't be able to contact...) with black magic

He made the contact form in html
http://www.tereschubert.com/tereform.html

and then, he created a "cgi-bin" folder with this file
http://www.tereschubert.com/help/teremail.cgi (<- this is not the actual folder, as I can't link the folder )


Simple enough, I was asked by my mom to change the contact form to something more simple.... (she wanted to have only three things: Name, e-mail, comments)

So I gave it my best, and modefied the tereform.html... unfortunately the thing would not send the e-mail because it was missing the wedding date (which is a required field in the old form). So I went ahead and modified the teremail.cgi

Next time I tried the form....whoa!! error!!

So I decided to place back the old files to make the form work again, but even putting the old files back I keep getting the same error when I try to send the form........ WHY?????

Can somebody offer me a solution? :shock: My mom need a working form.

leo
Sorry for the long post

Posted: Tue Sep 05, 2006 1:14 am
by Mihai
Can your server run php? is it ok if the form data is sent to her email directly, or does it have to be stored in a database?

Posted: Tue Sep 05, 2006 4:39 am
by Leonardo
Mihai wrote:Can your server run php?
I have no clue if it runs php... how can I find out?
is it ok if the form data is sent to her email directly, or does it have to be stored in a database
We only need the form to work, if you can make it work directly... It will be fine with me :D

Posted: Tue Sep 05, 2006 5:31 am
by Thomas An.
Leonardo wrote:if you can make it work directly... It will be fine with me :D
That would be $300, payable to Mihai (paypal prefered, but I think he might take a check too). :P

Posted: Tue Sep 05, 2006 5:43 am
by michaelplogue
Mom's gonna be sooooo pissed........ :shock: :wink:

(Deny everything. It's your only way out!)

Posted: Tue Sep 05, 2006 6:18 am
by MarkM
Hi Leo,
One thing that comes to mind is…what are the CHMOD settings for the cgi files? Maybe something as simple as that.
Leonardo wrote: I have no clue if it runs php... how can I find out?
I would go to your web hosting company page and see if its listed there or you could run this script (or any php script in this matter to see if it works) that will give you some useful information.

phpinfo.php
Code: Select all
<?php
phpinfo();
?>

To get you up and running now heres a sample html form and php code…

html code
Code: Select all
<form method="POST" action="/contactconfirm.php">
        <p align="center">&nbsp;</p>
        <p align="center"><b><font size="2" face="Verdana">Email Address: <input type="text" name="from" size="31" style="border: 1 solid #000000"></font></b></p>
        <p align="center"><b><font size="2" face="Verdana">Subject: <input type="text" name="subject" size="33" style="border: 1 solid #000000"></font></b></p>
        <p align="center"><b><font size="2" face="Verdana">Message:</font></b></p>

<center>
<p align="center"><textarea rows="11" name="note" cols="46"></textarea></p>
<p align="center"><input type="submit" value="Submit" name="B1">
<input type="reset" value="Clear" name="B2"></p>
        </form>

php code....

name the file contactconfirm.php and put it in the same directory your form file is in...Also change YOUR_EMAIL@ADDRESS.COM to the email address you want the form to send to…
Code: Select all
<?php
/* this pages recives and handles the data from contact.php
*/

$note = $note; 
$from = $from;
$to = "YOUR_EMAIL@ADDRESS.COM"; 
$subject = $subject; 
$message = $note; 
$headers = "MIME-Version: 1.0\n";   

                        $headers .= "Content-Type: text/html; charset=iso-8859-1\n";   

                        $headers .= "X-MSMail-Priority: Normal\n";   

                        $headers .= "From: <$from>\n";   

                        $headers .= "Reply-To: <$from>\n"; 

// Filter out email injection
if ((preg_match('/\\\[rn]/i', $from)) || (preg_match('/\\\[rn]/i', $subject))) {
   die("<center><b><font size=3 color=#000000>Spammers not welcome! If you believe you received this error incorrectly then please email us at $to </center></font></b>"); 
}else{
mail( $to, $subject, $message, $headers) and print "<b><font size=3 color=#000000> Thank you your email has been received. You should receive a reply soon from one of our representatives.</font></b>" or print "<b><font size=5> Could not send try again</font></b>"; 
}
?>
Let me know how this works out for you or if you need any help getting it to work. :wink:

Regards,
Mark

Posted: Tue Sep 05, 2006 2:05 pm
by Leonardo
This is good stuff... I'll try it, as soon as I get a chance


leo

Posted: Tue Sep 05, 2006 2:32 pm
by Leonardo
Oh... yes!!! it's working, now my mom will love me again

leo

Posted: Tue Sep 05, 2006 8:09 pm
by Leonardo
I'm back,
I need to refine a little more the contact form (My mom will not let me go this easy)

This is what I need...
example e-mail:
FROM: somebody@somewhere.com

SUBJECT: "Tere Contact Form" (Automate Subject... all e-mails coming from the contact form will have the same subject)

MESSAGE:
"Name:" (New input from a text field)
"Phone:" (New input from a text field)
"Email:" (same input from: "FROM" )
"Message:" (Message = note)

Sorry for being a pain :oops:
leo

Posted: Tue Sep 05, 2006 9:29 pm
by MarkM
Hey your no pain… glad I can help :)
ok give this a try we can refine it a little better if needed…I’m on my way out the door so I didn’t have time to make it nicer…but when I come back I’ll see were your at.


Cheers,
Mark
Code: Select all
<form method="POST" action="contactconfirm.php"> 
        <p align="center">&nbsp;</p> 
        <p align="center"><b><font size="2" face="Verdana">Name: <input type="text" name="name" size="33" style="border: 1 solid #000000"></font></b></p> 
		<p align="center"><b><font size="2" face="Verdana">Phone Number: <input type="text" name="phone" size="33" style="border: 1 solid #000000"></font></b></p> 
		<p align="center"><b><font size="2" face="Verdana">Email Address: <input type="text" name="from" size="31" style="border: 1 solid #000000"></font></b></p> 
                <p align="center"><b><font size="2" face="Verdana">Message:</font></b></p> 

<center> 
<p align="center"><textarea rows="11" name="note" cols="46"></textarea></p> 
<p align="center"><input type="submit" value="Submit" name="B1"> 
<input type="reset" value="Clear" name="B2"></p> 
        </form> 
Code: Select all
<?php 
/* this pages recives and handles the data from contact.php 
*/ 
$name = $name;
$phone = $phone;
$note = $note; 
$from = $from; 
$to = "YOUR_EMAIL@ADDRESS.COM"; 
$subject = "Tere Contact Form"; 
$message = "$name<br>$phone<br>$from<br><br>$note"; 
$headers = "MIME-Version: 1.0\n";    

                        $headers .= "Content-Type: text/html; charset=iso-8859-1\n";    

                        $headers .= "X-MSMail-Priority: Normal\n";    

                        $headers .= "From: <$from>\n";    

                        $headers .= "Reply-To: <$from>\n"; 

// Filter out email injection 
if ((preg_match('/\\\[rn]/i', $from)) || (preg_match('/\\\[rn]/i', $subject))) { 
   die("<center><b><font size=3 color=#000000>Spammers not welcome! If you believe you received this error incorrectly then please email us at $to </center></font></b>"); 
}else{ 
mail( $to, $subject, $message, $headers) and print "<b><font size=3 color=#000000> Thank you your email has been received. You should receive a reply soon from one of our representatives.</font></b>" or print "<b><font size=5> Could not send try again</font></b>"; 
} 
?>

Posted: Wed Sep 06, 2006 12:53 am
by Leonardo
Thanks a lot .... I got it working just the way I needed


leo