Jul 20, 2008

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

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

free web hosting

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

dwat
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!!!!!

 

 

 


Reply

CrazyRob
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?

Reply

jlhaslip
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.

Reply

Saint_Michael
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.

Reply

dwat
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

Reply

OneMinute
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)

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : php coding errors worked suddenly longer

  1. Coding Help! - Need Tutorial?! (3)
  2. Fopen Errors :( - grrr, i'm angry :( (6)
    Okay, i've made a very, very simple PHP counter for my site, i've set up all the permissions
    and everything (triple checked permissions are right); CODE <?php $hits =
    file_get_contents("/home/tracdoor/public_html/hitcounter.txt"); $hits =
    $hits + 1;    $handle = fopen("hitcounter.txt", "w");
    fwrite($handle, $hits); fclose($handle); print $hits;
    ?> Now that works fine on my homepage, or any page in the /public_html/ directory, but if i
    in...
  3. What Coding Languages Are Required? - (5)
    I want to add a feature in my website so that users can make a professional -looking resume-like web
    page. It will be like a form based series of questions that visitor ll need to answer.Based on this
    a webpage as prescribed in pre-defined template ll be created .I want to know to do this what
    languages are used? I want some suggestion regarding this.My site is currently on Joomla platform.
    thanks in advance...
  4. Help With Coding! - please anybody help me! (2)
    Hi all..(if this is in bad section then sorry) I have one big problem with my site and I don't
    know how I can repair it. I have auto refreshed Shout box at site but there is little problem!
    When this shout box is accessed for guest there are coming spam bots and just spamming it. I know
    how to do it but I don't know about php. I have code for make this shout box Spam protected, but
    I dont know how to do it. All time when I add this code to php file, there is all things okey but
    auto refresh is not working /sad.gif" style="vertical-align:middle" emoid=":(" bo...
  5. Php Frameworks - Leaner, More Efficient Coding. - A quick overview of what they are and where you can find some. (1)
    PHP Frameworks What do you guys think of coding websites using framworks like Zend or CakePHP? I
    used to code my applications from scratch but it does get tedious and because PHP is not as
    structured as other languages it's very easy to create redundant, unmaintainable code. I think
    a framework should be more than just a bunch of libraries. It's true that having libraries for
    functions specific to what you are trying to do might help alot but it takes more than that to
    create some maintainable code. What I' m talking about is MVC and Front Controllers. The...
  6. Header Redirect Errors - (5)
    Hi, I am using the header function to redirect after the processing of the form. I have to specify
    a internal link using '#link'. This works in Firefox and opera. But in Internet Explorer
    internal linking when done from a redirect is not working for somewhat reasons. e.g.
    header("Location: http://www.example.com/index.php#link"); this works in Firefox and Opera but
    not in Internet Explorer . IE just accepts 'http://www.example.com/index.php' instead of
    http://www.example.com/index.php#link Please help me if you know anything about this. Well ther...
  7. Script Not Working :s - mysql errors (5)
    process_login.php: Process the login. $host = "localhost";// the host that u are connecting
    $username = "root";// user name $password = ""; // passworld $basedatos =
    "forum"; //Dont change this1. $db = mysql_connect($host, $username, $password);
    mysql_select_db($basedatos, $db); $user= $_REQUEST ; $pass=
    md5($_REQUEST ); $query1= "SELECT * FROM smf_members WHERE
    memberName='$user'"; $mkquery= mysql_query($query1,$db); $row1=
    mysql_fetch_assoc($mkqu...
  8. Help With Some Website Coding - Databases and saving form results (4)
    Hey all, I was looking for some help with creating my new website. I have a form already created,
    with some text areas, checkboxes, drop down menu's, ect. I need some help setting up the code to
    save the form data once the user clicks "Submit" after filling in their information in the form. I
    was hoping to do this 2 ways - 1. Saving the information into some type of database (MySQL I'm
    guessing?) and 2. Have the form results emailed to me. I am familiar with the old way of emailing
    the results by putting "mailto:email@domain.com" into the form, but new browse...
  9. Coding Your Sites ? - Coding your sites (20)
    What kind of coding do you use on your sites? I have so far learnt using a little tables and
    div/css. /biggrin.gif' border='0' style='vertical-align:middle' alt='biggrin.gif' /> ...
  10. Requesting Auto Generating Id Tag In Php Code - Php Coding (2)
    Hello...I'm designing a website in PHP where ppl can submit their links for "cool sites".
    Anyway, when somebody submit's a link to a website for example "http://www.google.com" it
    creates an id such as "index.php?id=1134411593". I dont want the links to be converted into
    id's. I want it to remain as "http://www.google.com". I have the following coding on
    ( echo " ). I'm a novice. Please Help!!!!
    Thanks... Plus I also want to add the date on when the link was submitted. Please follow our foru...
  11. Html Within Php Coding - Is there a way to read HTML Code? (11)
    Is there a way to have PHP read a text file, which contains HTML Code, not text to display. This
    way i have a simple code in every page, linking to this text file, and then if i'm wanting to
    change the code, i only need to change the code in the text file. If that all makes sense?
    /biggrin.gif' border='0' style='vertical-align:middle' alt='biggrin.gif' /> I get the feeling it
    can be done, but the only code i have seen is one that displays the contents of the text files....
  12. Getting Errors On A Script - need to know what im doing wrong (3)
    ok please help me!! im trying to get this tournamt/leage ladder script working, its with php
    but i think i put all the files in the right palces but i keep getting this error .... CODE
    Warning: main(modules/NukeLadder/admin/index.php): failed to open stream: No
    such file or directory in /home/berkolli/public_html/DjLuki/admin/case/case.php on line 77
    Warning: main(modules/NukeLadder/admin/index.php): failed to open stream: No
    such file or directory in /home/berkolli/public_html/DjLuki/admin/case/case.php on line 77 W...
  13. Problem With Headers - setcookie errors (5)
    I'm having troubles with my authentication function, if the the users uses wrong login info, it
    works like a charm, but it gives me errors when i set the cookies, so help would be appreciated...
    CODE Function auth(){ $user=$_POST['username'];
    $pass=$_POST['password']; $qry="SELECT id from Solarity where
    username='$user' and password='$pass'";
    $result=mysql_query($qry) or die("A problem occured during authentication
    process"); $...
  14. Different Styles Of Mysql Coding. - (2)
    I look around the place, and at my own MYSQl scripts, and most look the same except with a few
    differing factors. Now Im relativly new to MYSQL, and not so new to PHP. The problem is though, I
    havent been able to test my scripts/site out so Im not sure if my scripts are right. For example,
    heres a script to create my user table. CODE <?php $DBhost = "localhost";
    $DBuser = "********"; $DBpass = "*********";   $DBName =
    "*********"; $connection = @mysql_connect($DBhost,$DBuser,$DBp...
  15. Getting Rid Of Errors - (4)
    Hi Is it ok to use error-reporting(0) locally in a snippet of code that spits an undefined variable
    error? I found that fix and was wondering what does everybody do about error messages that keep
    poping up. Thanks Patrick...
  16. Mysql Errors - cant find whats wrong :( (3)
    I am working on my guestbook, better to say I am transfuring it from old to new site, but I got some
    errors now I did not had at my old hoster and I cannot figure out whats wrong: CODE
    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in
    /home/pbrugge/public_html/guest.php on line 104 Warning: mysql_fetch_array():
    supplied argument is not a valid MySQL result resource in /home/pbrugge/public_html/guest.php on
    line 110 This is the complete relevant code perhaps I overlooked something but I keep ove...



Looking for found, php, coding, errors, thought, worked, suddenly, longer,

Searching Video's for found, php, coding, errors, thought, worked, suddenly, longer,
advertisement



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



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE