Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> New Found Php Coding Errors, I always thought these worked, but suddenly they no longer do?!
dwat
post Jun 28 2007, 02:54 PM
Post #1


Newbie
*

Group: Members
Posts: 2
Joined: 28-June 07
Member No.: 45,619



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.

CODE
----------------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!!!!!
Reason for edit: added code tags
Go to the top of the page
 
+Quote Post
CrazyRob
post Jun 28 2007, 03:32 PM
Post #2


ITS ALIVE.....MUHHHAAAA
*********

Group: Members
Posts: 532
Joined: 17-October 05
From: Chippenham UK
Member No.: 13,031



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?
Go to the top of the page
 
+Quote Post
jlhaslip
post Jun 28 2007, 04:01 PM
Post #3


A computer once beat me at chess, but it was no match for me at kick boxing.
Group Icon

Group: [MODERATOR]
Posts: 3,993
Joined: 24-July 05
From: In Trouble Again... still?
Member No.: 9,787
Spam Patrol



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.
Go to the top of the page
 
+Quote Post
Saint_Michael
post Jun 28 2007, 08:26 PM
Post #4


$p4m 0n j00 $h4m3 m3 0nc3 $p4m 0n m3 $h4m3 m3 7\/\/1c3
*********************

Group: [HOSTED]
Posts: 6,443
Joined: 21-September 04
From: 9r33|\| 399$ 4|\|D 5P4/\/\
Member No.: 1,218
T17 GFX Crew



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.
Go to the top of the page
 
+Quote Post
dwat
post Nov 4 2007, 04:09 AM
Post #5


Newbie
*

Group: Members
Posts: 2
Joined: 28-June 07
Member No.: 45,619



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 biggrin.gif

Daniel
Go to the top of the page
 
+Quote Post
OneMinute
post Nov 4 2007, 02:35 PM
Post #6


Member [Level 2]
*****

Group: [HOSTED]
Posts: 80
Joined: 18-October 07
Member No.: 51,724



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 trap17 community is. (Great support and friendliness biggrin.gif)
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Different Styles Of Mysql Coding.(2)
  2. Coding Your Sites ?(20)
  3. Problem With Headers(5)
  4. Getting Errors On A Script(3)
  5. Html Within Php Coding(11)
  6. Requesting Auto Generating Id Tag In Php Code(2)
  7. Script Not Working :s(5)
  8. Help With Some Website Coding(4)
  9. Header Redirect Errors(5)
  10. Php Frameworks - Leaner, More Efficient Coding.(1)
  11. Help With Coding!(2)
  12. What Coding Languages Are Required?(5)
  13. Fopen Errors :((6)
  14. Coding Help!(3)


 



- Lo-Fi Version Time is now: 5th September 2008 - 08:37 AM