Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: Damn you to hell PHP.  (Read 1096 times)

0 Members and 1 Guest are viewing this topic.

Xiphirx

wat
Damn you to hell PHP.
« on: October 30, 2008, 11:13:23 pm »
  • Xiphirx
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3007

Basically, I have a form

Code: [Select]
<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:&nbsp;</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
Code: [Select]
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

Code: [Select]
<?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
  • For The Swarm
Re: Damn you to hell PHP.
« Reply #1 on: October 30, 2008, 11:15:22 pm »
  • Super Hero Time!
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Female
  • Posts: 4859
Whoa. Unrelated but thanks for using the code tag, I gotta fix that green :(

Edit: Fixed.
« Last Edit: October 30, 2008, 11:26:02 pm by Zidane »
Logged
!@#$% I lost my entire post, god dammit.

Xiphirx

wat
Re: Damn you to hell PHP.
« Reply #2 on: October 30, 2008, 11:16:41 pm »
  • Xiphirx
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3007
Whoa. Unrelated but thanks for using the code tag, I gotta fix that green :(

:D
Logged
  • For The Swarm
Re: Damn you to hell PHP.
« Reply #3 on: October 31, 2008, 12:05:40 am »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
Error please. Just saying it dosen't work dosen't help anyone.
Logged

Xiphirx

wat
Re: Damn you to hell PHP.
« Reply #4 on: October 31, 2008, 12:08:15 am »
  • Xiphirx
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3007
Error please. Just saying it dosen't work dosen't help anyone.

That is it, I don't get an error.

Localhost, actually uses the function, when it is online, it doesn't, it just skips it and posts nothing.

Logged
  • For The Swarm

Xiphirx

wat
Re: Damn you to hell PHP.
« Reply #5 on: October 31, 2008, 03:13:49 am »
  • Xiphirx
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3007
Bump, when it is online, it does not use the javascript function and posts nothing...

EDIT: Fixed...
« Last Edit: October 31, 2008, 03:50:21 am by Xiphirx »
Logged
  • For The Swarm
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.464 seconds with 49 queries.