473,473 Members | 2,151 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Why Does My PHP Script No Longer Work?

chunk1978
224 New Member
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
2 1813
chunk1978
224 New Member
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
5,821 Recognized Expert Expert
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

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

Similar topics

4
by: lawrence | last post by:
Maybe its late and I'm tired but I don't understand what I'm seeing on the screen. I have this block of code: $choiceMade = $_GET; if ($simpleMode == "y" && $choiceMade == "") {...
12
by: lawrence | last post by:
I notice that when my weblog software tries to contact www.weblogs.com, to use the update service, my whole site (all PHP) slows down. Contacting www.weblogs.com can take a long time. I can't...
2
by: news frontiernet.net | last post by:
I have key entered and tried to run example 4-6 from Dany Goodmans DYNAMIC HTML book, version one that is on pages 94-96. This is part of my effort to learn JavaScript. I checked each byte and...
2
by: Eric Petzold | last post by:
This is a small excerpt of a larger script, but it is creating alot of frustration. I am trying to query the vaule of a hidden form field via onSubmit... if the function gets called out-right it...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.