Jump to content
xisto Community
Sign in to follow this  
dwat

New Found Php Coding Errors I always thought these worked, but suddenly they no longer do?

Recommended Posts

Hi i'm dan from new zealand, right next to my home land australia.
I have been writing php scripts for two years now and just recently none of them have been working.

Please help me out as best as you can, i'm sure it is only something simple.

----------------Form 1--------------------------<?php// ---- Customized form script for the HBRC---------------// Receiving variables -----------------------------------@$fn = addslashes($_POST['fn']);@$ln = addslashes($_POST['ln']);@$f1 = addslashes($_POST['f1']);@$f2 = addslashes($_POST['f2']);@$f3 = addslashes($_POST['f3']);//---------------------------------------------------------------//-------Loop for Image relevant variables----------------for ($i = 1; $i <= 3; $i++){$fl = "fl$i";@$fl[$i]= $_FILES[$Image_Upload]['name'];@$fl_Size[$i]= $_FILES[$Image_Upload]['size'];@$fl_Name[$i]= $_FILES[$Image_Upload]['name'];@$fl_Temp[$i]= $_FILES[$Image_Upload]['tmp_name'];}function RecursiveMkdir($path){if (!file_exists($path)){RecursiveMkdir(dirname($path));mkdir($path, 0777);}}//---Upload the files if they exist---------------------------------for ($i = 1; $i <= 8; $i++){if ($fl_Size[$i] < $size and $fl_Size[$i] >0){$uploadFile = "uploads/".$fl_Name[$i];if (!is_dir(dirname($uploadFile))){@RecursiveMkdir(dirname($uploadFile));}else{@chmod(dirname($uploadFile), 0777);}@move_uploaded_file( $Image_Upload_Temp[$i] , $uploadFile);chmod($uploadFile, 0644);$Image_URL[$i] = "../images/uploads/".$fl_Name[$i];}}//---------------------------------------------------------------// Find Server date and Time (note server location-HBRC in US)---$date = date("l jS F Y, g:i A");//---------Sending Email to form owner ---------------------------$nd_header = "From: $pn\n". "Reply-To: $pea\n";$nd_subject = "Upload to the HBRC Website";$nd_email_to = "eitassignment@hbrc.dwat.co.nz";$nd_message = "New File(s):\n". "-------------------------------------------\n". "Senders First Name: $fn\n". "Senders Last Name: $ln\n". "Senders Email Address: $ea\n". "Senders Desired Password: $dp\n". "-------------------------------------------\n". "Fees are up to date: $mf\n". "-------------------------------------------\n";for ($i = 1; $i <= 8; $i++){if (@$Image_Upload_Size[$i] >0){$nd_message .= "Link to image $i : $Image_URL[$i] \n. "-------------------------------------------\n";}}. "-------------------------------------------\n"$nd_message .= "Date of Submission : $date\n". "-------------------------------------------\n"&mail($nd_email_to, $nd_subject ,$nd_message ,$nd_header );header("Location: thankyou.html");?>----------------------------------Form 2 ------------------------------------<?php// ---- Customized form script for the HBRC---------------// Receiving variables -----------------------------------@$fn = addslashes($_POST['fn']);@$ln = addslashes($_POST['ln']);@$dp = addslashes($_POST['dp']);@$ea = addslashes($_POST['ea']);@$mf = addslashes($_POST['mf']);//---------------------------------------------------------------// Find Server date and Time (note server location-HBRC in US)---$date = date("l jS F Y, g:i A");//---------Sending Email to form owner ---------------------------$nd_header = "From: $pn\n". "Reply-To: $pea\n";$nd_subject = "Query from the HBRC website";$nd_email_to = "eitassignment@hbrc.dwat.co.nz";$nd_message = "New Query:\n". "-------------------------------------------\n". "Senders First Name: $fn\n". "Senders Last Name: $ln\n". "Senders Email Address: $ea\n". "Senders Desired Password: $dp\n". "-------------------------------------------\n". "Fees are up to date: $mf\n". "-------------------------------------------\n"$nd_message .= "Date of Submission : $date\n". "-------------------------------------------\n"&mail($nd_email_to, $nd_subject ,$nd_message ,$nd_header );header("Location: thankyou.html");?>-------------------------------------Form 3 -------------------------------<?php// ---- Customized form script for the HBRC---------------// Receiving variables -----------------------------------@$fn = addslashes($_POST['fn']);@$ln = addslashes($_POST['ln']);@$dp = addslashes($_POST['pn']);@$ea = addslashes($_POST['ea']);@$mf = addslashes($_POST['cm']);@$mf = addslashes($_POST['qy']);//---------------------------------------------------------------// Find Server date and Time (note server location-HBRC in US)---$date = date("l jS F Y, g:i A");//---------Sending Email to form owner ---------------------------$nd_header = "From: $pn\n". "Reply-To: $ea\n";$nd_subject = "Query from the HBRC website";$nd_email_to = "eitassignment@hbrc.dwat.co.nz";$nd_message = "New Query:\n". "-------------------------------------------\n". "Senders First Name: $fn\n". "Senders Last Name: $ln\n". "Senders Email Address: $ea\n". "Senders Phone Number: $pn\n". "-------------------------------------------\n". "Query: $qy\n". "-------------------------------------------\n". "Contact Method: $cm\n". "-------------------------------------------\n"$nd_message .= "Date of Submission : $date\n". "-------------------------------------------\n"&mail($nd_email_to, $nd_subject ,$nd_message ,$nd_header );header("Location: thankyou.html");?>--------------------------------The end --------------------------

Thank you for your time. I am in need of these to work as it is for an assignment due in 5 hours time!!!!!

Share this post


Link to post
Share on other sites

can i ask what type of PHP script it is? then i may be able to help you further. The onyl supprot i can provide you with currently is the question of: are the permissions set correctly and the sendmail / mail() function supported by your host?

Share this post


Link to post
Share on other sites

Read the information here: http://ca.php.net/manual/en/function.mkdir.php

About the third posting down, the user points out that newer versions of php seem to need the trailing slash in the mkdir path name. You don't specify what version of php you are using, so I don't know if it is the fix you need.

ALWAYS go to the php.net documentation FIRST. And read carefully the notes/comments about the function which is failing.

Also, checking the mkdir function information, 0777 is the default permissions. Maybe the Server's php.ini is altered to affect that, but the next thing to check is be sure you are using the numeric zero and not the capital 'o' in the mode definition.

If this script has worked for you in the past, I would suspect that the Server has been upgraded to a newer version of php. Ask your ISP if that is the case and find out what has been changed relative to the older version by looking for changelog information at the php.net site.

Share this post


Link to post
Share on other sites

Like haslip mention it oculd just be the php version and if thats the case you would have go through the structure of your scripts and adapt them to php 5 standards. Or if you want to save yourself a large headache (thats arguementative) recode the scripts so they are both php 4 and php 5 compliant.

Share this post


Link to post
Share on other sites

Hey thanks for the replys everybody.I handed the assignment in as it was, much to my disgression. Just last week I got my grades back with a pass result, yay!Anyway I would jsut like to say thanks for the help, and you were right in saying that the php version on my server was recently upgraded, making my code non-compliant with the new requrements.I am not a fan of ASP or anything like that, PHP is my life, so I was worried for a second there that my PHP skills may have become redundant!Anyways just came to say thanks :rolleyes: Daniel

Share this post


Link to post
Share on other sites

Hey matey, relax there. Take up something else, perhaps web-design, this had do you good for don't always put all your eggs into one basket. Good luck! Anyway, this seems to show how great Xisto community is. (Great support and friendliness :rolleyes:)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.