By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,751 Members | 1,149 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,751 IT Pros & Developers. It's quick & easy.

Why Does My PHP Script No Longer Work?

chunk1978
100+
P: 224
i wrote a custom PHP script last year and everything worked perfectly... recently my webserver upgraded to PHP 5 and now my script doesn't work properly.

what the script does is: users fill out info and optionally can upload images, the user receives and email receipt of all the data they just submitted, and i'm suppose to receive their information in my email.

what still works is that the user will receive their receipt and the images are uploaded to the designated "client_uploads" folder, and i never receive the submitted information in my email address. but it doesn't really make sense to me because when i fill out the form, it does send and will eventually lead me to the thank you page, which according to the script below, will only be visible if the user receives the email and i receive the email... but i never receive the email... *scratches head*

my script is quite long, so i'm cut out parts that aren't important:

[PHP]<?php

# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- FILE UPLOADS

$datafiletext = $_POST["datafiletext"];
$datafiletextclass2 = $_POST["datafiletextclass2"];
$filedate = date("d-m-Y");
$uploadfolder = "../../../../client_uploads/";
$uploadfileA = $uploadfolder . 'MY_SITE-' . $filedate . '-' . basename($_FILES['datafile']['name']);

if ($datafiletext != "")
{
$fileAuploaded = @move_uploaded_file($_FILES['datafile']['tmp_name'], $uploadfileA);
$fileAuploaded ? FileB() :
header ("Location: http://www.mysite.com/english/restoration/assignmentform/error.html");
}
else
{
FileB();
}

function FileB()
{
$datafiletext = $_POST["datafiletext"];
$datafiletextclass2 = $_POST["datafiletextclass2"];
$filedate = date("d-m-Y");
$uploadfolder = "../../../../client_uploads/";
$uploadfileB = $uploadfolder . 'MY_SITE-' . $filedate . '-' . basename($_FILES['datafileclass2']['name']);

if ($datafiletextclass2 != "")
{
$fileBuploaded = @move_uploaded_file($_FILES['datafileclass2']['tmp_name'], $uploadfileB);
$fileBuploaded ? ClientMail() :
header ("Location: http://www.mysite.com/english/restoration/assignmentform/error.html");
}
else
{
ClientMail();
}
}

# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- CLIENT MAIL

# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- PHP VARIABLES

function ClientMail() {

$name = $_POST["name"];
$addressline1 = $_POST["addressline1"];
$addressline2 = $_POST["addressline2"];
#a bunch of other variables

# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- SEND CLIENT EMAIL / MIME BOUNDARY

$mime_boundary = "----MY_SITE----".md5(time());

# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-- HEADERS

$to = "$email";
$subject = "Assignment Form Online Submission Received";
$headers = "From: MY_SITE <reception@mysite.com>\n";
$headers .= "Reply-To: MY_SITE <reception@mysite.com>\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\n";

# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- TEXT FORMAT START

$message = "--$mime_boundary\n";
$message .= "Content-Type: text/plain; charset=UTF-8\n";
$message .= "Content-Transfer-Encoding: 8bit\n\n";


$message .= "$name:\n\nThis email is to confirm that MY_SITE has received your assignment via Assignment Form Online.\n\n";


# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- HTML FORMAT START

$message .= "--$mime_boundary\n";
$message .= "Content-Type: text/html; charset=UTF-8\n";
$message .= "Content-Transfer-Encoding: 8bit\n\n";

$message .= "<html>\n";
$message .= "<body style=\"font-family:Verdana, Verdana, Geneva, sans-serif; font-size:11px; color:#999999;\">\n";
$message .= "$name:\n\nThis email is to confirm that MY_SITE has received your assignment via Assignment Form Online.\n\n";
$message .= "</body>\n";
$message .= "</html>\n\n";

# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- HTML FORMAT END / FINAL BOUNDARY

$message .= "--$mime_boundary--\n\n";





# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- SEND EMAIL TO CLIENT
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- SEND EMAIL TO CLIENT
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- SEND EMAIL TO CLIENT





$mail_sent = @mail( $to, $subject, $message, $headers );
$mail_sent ? MY_SITEMail() :
header ("Location: http://www.mysite.com/english/restoration/assignmentform/error.html");

}



# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- SEND EMAIL TO MY_SITE
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- SEND EMAIL TO MY_SITE
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- SEND EMAIL TO MY_SITE





function MY_SITEMail() {

# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- PHP VARIABLES

$name = $_POST["name"];
$addressline1 = $_POST["addressline1"];
#a bunch of other variables
$ftpuploadfolder = "ftp://login:password@mysite.com:21//client_uploads/";
$ftpfileA = 'MY_SITE-' . $filedate . '-' . $datafiletext;
$ftpfileB = 'MY_SITE-' . $filedate . '-' . $datafiletextclass2;

# -=-=-=- MY_SITE'S EMAIL HEADERS

$imageemail = "MY_SITE <reception@mysite.com>";
$imagesubject = "Assignment Form Online Submission";
$imageheaders = "From: $name <$email>\n";
$imageheaders .= "Reply-To: $name <$email>\n";
$imageheaders .= "MIME-Version: 1.0\n";
$imageheaders .= "Content-Type: text/html; charset=UTF-8\n";
$imageheaders .= "Content-Transfer-Encoding: 8bit\n\n";

# -=-=-=- MY_SITE'S HTML (ONLY) EMAIL BODY

$imagemessage = "<html>\n";
$imagemessage .= "<body style=\"font-family:Verdana, Verdana, Geneva, sans-serif; font-size:12px; color:#999999;\">\n";
$imagemessage .= "<br>\n";
$imagemessage .= "Bla Bla Bla\n\n";
$imagemessage .= "</body>\n";
$imagemessage .= "</html>\n\n";

# -=-=-=- SEND MY_SITE MAIL

mail($imageemail, $imagesubject, $imagemessage, $imageheaders);
header ("Location: http://www.mysite.com/english/restoration/assignmentform/complete/");

}
?>[/PHP]

i'm concerned that server admins changed something (but i don't know what, other than upgrading PHP)... i'm really not amazingly strong at PHP, but i'm 100% certain that this script worked flawlessly and now it doesn't... i've contacted my host and they told me they're not web developers so essentially i'm on my own... would the new PHP version support older syntax?

i really hope someone can help me out here... i'm quite lost.
Aug 14 '08 #1
Share this Question
Share on Google+
2 Replies


chunk1978
100+
P: 224
nevermind... my host server contacted me saying "it should work now"... so clearly the script is fine and that the fault lies with them... and yes, it does work now...
Aug 14 '08 #2

pbmods
Expert 5K+
P: 5,821
Heya, Chunk.

Glad to hear you got it all sorted out. Good luck with your project, and if you ever need anything, post back anytime!
Aug 14 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.