|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome. |
Share Thread: & Tags
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
i forgot the js code
<script type="text/javascript"> // <![CDATA[ jQuery(document).ready(function(){ $('#contactform').submit(function(){ var action = $(this).attr('action'); $.post(action, { name: $('#name').val(), email: $('#email').val(), company: $('#company').val(), subject: $('#subject').val(), message: $('#message').val() }, function(data){ $('#contactform #submit').attr('disabled',''); $('.response').remove(); $('#contactform').before('<p class="response">'+data+'</p>'); $('.response').slideDown(); if(data=='Message sent!') $('#contactform').slideUp(); } ); return false; }); }); // ]]> </script> |
|
||||
|
Hi,
Your best bet is to delete the PHP script and find one that is written in Perl. Lyle
__________________
Lyle Hopkins Internet Marketing Tutorials, guides and advice Affiliate software Advanced Affiliate Solutions |
|
|||
|
Your answer begs the question. Why not suggest any good site that has a collection of PHP and Perl scripts? Hotscripts is one I have used successfully. In short, his problem can be solved by using another PHP script (Perl is not necessary). Furthermore, I'd highly suggest he use a mail form that uses Captcha to foil spammers.
|
|
|||
|
the contact.php is in different folder assets ? is that necessary?
click on the link below, it is a simple functional contact form, you just have to edit the email you want to connect to and the thank you page: http://ffmpeg-hosting.net/contact-form.zip if you need more fields you just have to edit the form not the contact.php Last edited by visio; 08-27-2009 at 05:24 PM. |
|
|||
|
i would suggest getting rid of that php too, so many spammers hack php form codes. Why not try using a service like hform.com, you can have them process the form data securely thru an encryption to there servers, store in database and email you results, have image captcha, have required fields, and an auto-responder. It's a good option for a non-programmer and the cost is so little ($2.50 a month I think). Your host service would likely be pleased that the processes are not vulnerable on your host space too. They've been around for years now and I've seen plenty of small and large scale busineses use the services, have peace of mind that your website is protected from form spammers and your email is also protected from general spambots.
If you're a programmer, you could use perl, or at least have your email kept in an ini file for better security and use code from tectite.com perhaps (they have a good one). Hope this information helps, good luck! Last edited by enicola; 08-27-2009 at 05:28 PM. Reason: typo |
|
|||
|
The codes looks okay on the surface. Instead of having it just say "ERROR", try printing out some debug info to see what it is trying to do. For example:
replace: echo 'ERROR!'; with: echo "Unable to send to |$your_email| with subject of |$email_subject| and message of |$email_content|\n"; You might also make sure you have permission to send email at all, by hard-coding a mail call for each submission. So just throw this at the bottom of the script: mail ("sales@distinctdesignus.com", "script completed", "Look at me, I'm the message body");
__________________
Looking for a unique gift? Send one of our gourmet cookie bouquets today. Food lovers - visit the Gourmet Gift of the Day Blog for delicious ideas. |
|
|||
|
Php for contact forms are fine but thatscript is kind of crappy. Look at phpmailer google it I'm on my iPhone right now but that is a lot better to use than just regular mail()
|
|
|||
|
The OP's problem could be solved, also, by looking for mistakes or clues in the posted code, and once that's ruled out, then suggest other code. Did they not already go to the trouble of finding and installing this code? Let's be helpful here.
First off, is your jQuery library present and loading? Should there be a comment ( // ) in the line declaring the errors array in your PHP? Is the PHP generating the form correctly? Check the page source in a browser and look for errors. Trust the code you have, and make it work. No sense throwing out the baby with the bath water. A better solution, if one is to be had, will show itself when the time comes. |
|
||||
|
First things first. The jQuery javascipt you are using to submit the form is probably going to fail. The form action="" needs to be an entire url for the javascript to send the request properly I believe.
Secondly, this php works fine for me in testing: Code:
<?php
if($_POST){
$email = $_POST['email'];
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email )){
$error.="Invalid email address entered";
$errors=1;
}
if($errors==1){
echo $error;
}
else{
$values = array ('name','email','message');
$required = array('name','email','message');
$your_email = "sales@distinctdesignus.com";
$email_subject = "New Message: ".$_POST['subject'];
$email_content = "new message:\n";
foreach($values as $key => $value){
if(in_array($value,$required)){
if ($key != 'subject' && $key != 'company') {
if( empty($_POST[$value]) ) {
echo 'PLEASE FILL IN REQUIRED FIELDS';
exit;
}
}
$email_content .= $value.': '.$_POST[$value]."\n";
}
}
if(@mail("$your_email", "$email_subject", "$email_content", "From: $your_email")) {
echo 'Message sent!';
}
else {
echo 'ERROR!';
}
}
}
?>
|
|
||||
|
I agree with enikola. I have abandoned PHP long time ago. I am using the CofeeCup WebForm Builder that designs beautiful flash-based forms that is not easy to hack and it does not reveal the e-mail address. You have everything you need (redirection, CAPTCHA, instant verification, colors, pics, more!
I have seen some attempts to hack it by filling out the garbage text and see where it goes but that's all: No interest because you can see nothing inside!
__________________
The Cyber Teacher http://www.rtek2000.com http://www.800-webdesign.com/web-master-links.html -Free Web Master's Resources _________________ |
|
||||
|
First, I compared yours to what we use.
I noticed that my @mail has four parameters. A 4th parameter is the "From" address. I define it as such: $to = "youremail@yourdomain"; $headers = "From: $to"; So my @mail looks like : @mail($to, $subject, $body, $headers) Our ISP required that field. I added some additional checking functions that I had found suggested elsewhere. Also, I found it helpful to use echo statements when I was in the process of debugging to make sure variables and such had the expected information. Your welcome to PM me if you want me to send you the code we use. cd :O) |
|
||||
|
One question... did you save the form document with a .php file extension?
I've personally moved away from contact forms because of the spambot problem, but recently came across a php script with a simple 'captcha' that is relatively easy to install, by changing only a few settings in the config file. freecontactform.com - there is a free and professional version. puamana |
|
|||
|
You need to do a better job writing your php code.
Here is a very good tutorial to help get you started coding your own php forms. It has good php validation, and all you gotta add in is mail() to send out the form. PHP form tutorial
__________________
Ontario Traffic Ticket Forum |
|
|||
|
I am on a computer now.. it looks like you are getting the ERROR when actually trying to send the mail.
if(@mail($your_email,$email_subject,$email_content )) { echo 'Message sent!'; } else { echo 'ERROR!'; } so do this.. in your page, or create a new page... <?php mail("youremail@email.com","test","test content"); ?> and run it. Did you receive the email? NO... do you get any errors on the page or in your error_log? Does your server even have mail() enabled? try running it without the @ in front of the mail, then check for errors. YES... try echoing out your mail call. change if(@mail("$your_email", "$email_subject", "$email_content", "From: $your_email")) { echo 'Message sent!'; } else { echo 'ERROR!'; } to echo "$your_email", "$email_subject", "$email_content", "From: $your_email"; exit; and see what it says. |
|
|||
|
Quote:
The above post points to related problem, so the URL is probably the only fly in the ointment, all other things being correct. |
|
|||
|
One thing I seen that's missing security wise is the strip_tags function. Always use this when receiving form input. If you are relaying information from a form to a database, always use mysql_real_escape_string with the strip_tags.
|
|
|||
|
Pretty much what a53mp said, but I would change:
if(@mail("$your_email", "$email_subject", "$email_content", "From: $your_email")) { echo 'Message sent!'; } else { echo 'ERROR!'; } to somthing like: if(@mail("$your_email", "$email_subject", "$email_content", "From: $your_email")) { echo 'Message sent!'; } else { echo "email: " . $your_email . "<br>subject: " . $email_subject . "<br>content: " . $email_content . "<br>from: " . $your_email; } This is where the error is occuring, so if you echo out the variables you will be able to see if any are wrong. |
|
|||
|
Quote:
Doing if(@mail( is a bit redundant. |
|
|||
|
I haven't looked a the code in any detail but is your server set up to allow emails to be sent from 'nobody'? If not, you could try enabling that, or better still, define the 'from' field in the process page itself. No real need to move away from php, there are plenty of tutorials out there that show you how to add captcha fields without any advance knowledge in php. Just make sure you set up a lot of very different, fairly complex captcha images
|
|
||||
|
Hey guys, sorry i had the flu the last couple days and did not get a chance to see any replies.
Any simple solutions/fixes that I can get a page up an running quickly. I like how this would just say at the top of the contact form if it was sent or not instead of doing a whole new page for that. I am not an expert in contact forms and im not an expert with php but i can decode (sorta) easy fix ideas? not worried about security right now. |
|
|||
|
If I'm not wrong, wordpress has got a contact form plugin too.
You may use it if the site is powered by wordpress.
__________________
Download Free DVD Movies || Cold Sore Treatment || Best eBooks & Software Downloads || |
|
||||
|
This will probably not be a very popular answer, but it's a method I used, while I was still in the process of trying to learn php.
Email Me Form™ - HTML Forms, Web Forms, PHP Forms offers a fully customizable email me form, with "must enter" and captcha included, that is very simple to use, and requires no ads or credits back to them. The free version, however, is actually hosted on their site, which I highly recommend against, for obvious security reasons. There is also a one-time charge of $3.95 USD, and you can then download the entire code for placement on your site, which is what I opted for. I definitely would have preferred to write my own, but time was pressing, and I hadn't gotten to that level yet. This is serving me well in the meantime.
__________________
If I ever stop learning, let the wolves have my carcass. ![]() http://doccampbell.wordpress.com/ http://cleanstreamwaterconditioning.com http://carforums-online.com |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Contact Form without Spam | mib | Internet Security Discussion Forum | 6 | 09-28-2009 05:19 PM |
| Simple contact form help...please!? | andthen | Web Programming Discussion Forum | 9 | 08-13-2009 01:06 PM |
| Contact Form | owt200x | Internet Security Discussion Forum | 0 | 01-15-2009 05:14 PM |
| Need to Build a Contact Form | brianzajac | Web Programming Discussion Forum | 0 | 06-05-2006 06:20 PM |
| Contact Form being Hi-jacked - HELP! | fisher318 | Internet Security Discussion Forum | 4 | 09-12-2005 03:14 PM |
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |