Jump to content

Php Script Problem - Used To Work, Now It Doesn't


8point2

Recommended Posts

Hi guys, having a problem with a .php script that a friend of mine made (tried to get help from him but he is out of the country at the moment, and I would really like to get this fixed). It's a fairly straightforward script, which I have used with success on other websites (and my Totalchoicehosted site) to take the information from an html form and send it as text to an email address.

 

What's so weird is that this script used to work on my TCH site, and in fact, only stopped working two weeks or so ago according to the client (I am jsut a designer). Now it brings up a page with a 500 Internal Server Error, script may be misconfigured, etcetc. It definitely used to work, I tested it heavily..and I have not made any changes to the script since. So to test, yesterday, I uploaded the script and the HTML form to another web domain (not TCH hosted) and it does work there as expected. (I receive the email, and the "Thank you" page displays).

 

What could have gone wrong? I tried to contact TCH for support but they can't help with coding issues, but were able to share this:

 

I tried to reproduce the error and checked the logs. I was able to see the following error in the apache error file.

 

Error

-----

[Mon Apr 25 20:49:11 2005][error] [client 202.56.253.42] Premature end of script headers: [...]/cgi-bin/thankyou.php

[Mon Apr 25 20:49:11 2005] [error] [client 202.56.253.42] File does not exist: [...]/500.shtml

 

I've looked at the script, but I haven't made any changes, so I'm at kind of a loss. Any suggestions for what could have gone wrong? I have tried deleting and reuploading the .php

 

Thanks!

Link to comment
Share on other sites

Have you or your client changed anything on the site--file permissions or .htaccess or anything like that?

 

Also, if the PHP version was updated recently on your server, that might have affected something in your script. Without seeing your code, it's hard to tell what's going on. Is it short enough to post?

Link to comment
Share on other sites

Have you or your client changed anything on the site--file permissions or .htaccess or anything like that?

 

Also, if the PHP version was updated recently on your server, that might have affected something in your script. Without seeing your code, it's hard to tell what's going on. Is it short enough to post?

 

Yes, it's pretty short! Surrounding this, there is a lot of HTML, some javascript stuff, none of that could be causing the problem, though, right?

Here's the actual php part:

 

<?php

//////////////////////////////

// Here we will do processing of the form into variables that will

// be emailed out

//////////////////////////////

 

// Here are variables you can change

$recipient = "..@gmail.com";

$subject = "Booking";

 

// Here we allocate the request information

$engagementType = $_REQUEST["engagementType"];

$dates = $_REQUEST["dates"];

$audienceSize = $_REQUEST["audienceSize"];

$groupName = $_REQUEST["groupName"];

$contactPerson = $_REQUEST["contactPerson"];

$address = $_REQUEST["address"];

$city = $_REQUEST["city"];

$state = $_REQUEST["state"];

$zip = $_REQUEST["zip"];

$telephone = $_REQUEST["telephone"];

$fax = $_REQUEST["fax"];

$email = $_REQUEST["email"];

$details = $_REQUEST["details"];

 

$message = "Type of engagement: ${engagementType}\n" .

"Tentative dates: ${dates}\n" .

"Audience Size: ${audienceSize}\n" .

"Organization: ${groupName}\n" .

"Contact Person: ${contactPerson}\n" .

"Address: ${address}\n" .

"City: ${city}\n" .

"State: ${state}\n" .

"Zip: ${zip}\n" .

"Telephone: ${telephone}\n" .

"Fax: ${fax}\n" .

"Email: ${email}\n" .

"Details: ${details}";

 

mail($recipient,$subject,$message);

?>

 

 

That's it!

 

Thanks for the help guys

Link to comment
Share on other sites

This is what the php code looks like in relation to the HTML/javascript tags.

 

(random javascript code)

}

//-->

</script>

</head>

 

<body onLoad="MM_preloadImages('../../MAP/navbar/05intro_glow.jpg','../../MAP/navbar/05bio_glow.jpg','../../MAP/navbar/05music_glow.jpg','../../MAP/navbar/05booking_glow.jpg','../../MAP/navbar/05contact_glow.jpg','../images/insets/teachers.jpg')" onmousemove="closesubnav(event);">

 

<?php

(the php code posted above)

 

?>

<table width="778" border="0" align="center" cellpadding="0" cellspacing="0">

<tr>

(more html)

Link to comment
Share on other sites

TCH-Andy's comment on blank lines rings a bell with me too -- did you already check and make sure that wasn't the problem?

 

When you added $headers to the mail line, did you ever define what $headers should be? If you just added "$headers" to the mail line, it won't have a value and so it wouldn't have fixed the problem. Try adding

 

$headers = "From: you@yourdomain.ext";

 

above the mail line and see if that helps.

Link to comment
Share on other sites

TCH-Andy's comment on blank lines rings a bell with me too -- did you already check and make sure that wasn't the problem?

 

When you added $headers to the mail line, did you ever define what $headers should be? If you just added "$headers" to the mail line, it won't have a value and so it wouldn't have fixed the problem. Try adding

 

$headers = "From: you@yourdomain.ext";

 

above the mail line and see if that helps.

 

 

Trying that now, I'm afraid I'm not sure what you mean by "blank lines" in the include file? Black lines in my php code? I figured it was like HTML, where hitting return to space out lines does not actually affect the way the stuff displays, but just helps the coder to organize.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...