|
« on: October 30, 2008, 11:13:23 pm »
|
|
Basically, I have a form <img src="img/contact.png" /> <br/><br />
<form action="" method="POST" onSubmit="return SubmitContact(this);" id="submitcontact"> <table width="100%"> <tr><td width="10%">Name:</td><td><input type="text" name="contactname" size="20" id="contactname"/></td></tr> <tr><td width="10%">Subject:</td><td><input type="text" name="contactsubject" size="20" id="contactsubject"/></td></tr> <tr><td width="10%">Email:</td><td><input type="text" name="contactemail" size="20" id="contactemail"/></td></tr> <tr><td width="10%">Message: </td><td> <textarea rows="15" name="contactmessage" cols="40" id="contactmessage"></textarea></td></tr> </table> <input type="submit" value="Submit" id="SubmitButton"/> </form> <div id="notify"></div>
<small>Please do not abuse this form, doing so will result in an IP ban/e-mail ban/ and possibly an ISP ban.</small>
, when the user submits it, it goes to this javascript function function SubmitContact(form) { var name = form.contactname.value; var subject = form.contactsubject.value; var email = form.contactemail.value; var message = form.contactmessage.value; var ip = '<!--#echo var="REMOTE_ADDR"-->'; form.contactname.className = ""; form.contactsubject.className = ""; form.contactemail.className = ""; form.contactmessage.className = ""; if (message.length < 10) { form.contactmessage.className = "error"; return false; } if (subject.length < 2) { form.contactsubject.className = "error"; return false; } if (email == "" || email.length < 2 || email.indexOf("@") < 1 || email.lastIndexOf(".") - email.indexOf("@") < 2 || email.indexOf("bugmenot") >= 1 || email.indexOf("mailinator") >= 1) { form.contactemail.className = "error"; return false; } form.contactname.disabled = true; form.contactsubject.disabled = true; form.contactemail.disabled = true; form.contactmessage.disabled = true; form.SubmitButton.disabled = true; form.SubmitButton.value = "Submit"; document.getElementById("notify").innerHTML = "<center><strong><font color='green'>Sending...</font></strong></center>"; var prot = DICKBUTT(); prot.onreadystatechange = function() { if (prot.readyState == 4) { if (prot.status != "200") { document.getElementById("notify").innerHTML = "<strong><font color='red'>We're sorry!, we cannot process any requests at this time.</font></strong>"; } document.getElementById("notify").innerHTML = "<strong><font color='green'>Thank you!, we will get back to you as soon as possible</font></strong>"; } }; var params = "contactname="+name+"&contactemail="+email+"&contactsubject="+subject+"&contactmessage="+message+"&ip="+ip; prot.open("POST", "processform.php", true); prot.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); prot.setRequestHeader("Content-length", params.length); prot.setRequestHeader("Connection", "close"); prot.send(params); return false; }
It then displays "Sent" or yadda yadda yadda, anyway, this is the "processform.php" file that is posted to <?PHP $name = $_POST['contactname']; $email = $_POST['contactemail']; $message = $_POST['contactmessage']; $subject = $_POST['contactsubject']; $id = date('l jS \of F Y h:i:s A'); $ip = $_POST['ip']; $subject = $id." --- ".$_POST['contactsubject']; $headers = "From: XE Contact Form \n". "Reply-To: $email\n". "X-Mailer: PHP/".phpversion();
$messagecom = " #########################################\n". "## THIS IS AN AUTO GENERATED E-MAIL ##\n". "#########################################\n". "\n\n". "Contact Name: $name \n". "Contact e-mail: $email \n". "Contact Number: $id \n". "Contact IP: $ip \n". "Subject: $subject \n". "The contact has left the following message, \n\n". "$message \n". "#################################################################";
//this is where the contact form is sent to $to = 'xiphirx@gmail.com'; (mail($to, $subject, $messagecom, $headers)) ?>
Ok, the problem is that when I run this locally on my apache server, it works fine. When I upload it online ( www.xeclan.co.nr) it totally fails. Any thoughts?
Logged
|
|