A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: PHP Scriptors

  1. #1
    Senior Member
    Join Date
    Jul 2001
    Location
    Tinley Park, IL
    Posts
    702

    PHP Scriptors

    I have designed a website for someone that has static information boxes that can be updated through a user update interface. The problem I'm having is remembering how to write the PHP script. Here is what I have if someone can help.
    PHP Code:
    // Variable $update is the receiving variable from the update
    // form.

    $update=fopen("./infobox1.txt","w+"); //open the txt file
    fwrite($update); //write the contents to txt file
    fclose($update); //close the file
    echo "&infobox1=$update"// output the file's information 
    I know I'm missing something.

  2. #2
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    looks ok, hard to say what the problem is you didn't state what the error was.

    Oh and Now that I think about it The way we do this is to simple INCLUDE the file
    Last edited by blanius; 04-26-2003 at 12:29 PM.

  3. #3
    Senior Member
    Join Date
    Jul 2001
    Location
    Tinley Park, IL
    Posts
    702
    Maybe I need to explain this better.

    A user will open a webform for the specific box they want to update.
    They enter the information into the webform and it get's sent to the .txt file.

    The website will open as normal and each of the info boxes will load the information from the appropriate .txt files and post to the website.

    The reason behind this is, I want the my client to be able to update the information on the website with ease and not really need access to my server directly unless I really have to.

    I've gone over the code a hundred times and I can't figure out why it's not writing to the file.

    fopen("text.txt","w+"); is supposed to open the file, delete the contents and place the cursor at the beginning. Also, the w+ mode is supposed to create the file IF it doesn't exist.

    Maybe it's the CHMOD? IF that IS the problem, I host my own websites. How the hell do I CHMOD a file on my own server if all I have to do is copy a file to a directory as opposed to uploading it to the server???

  4. #4
    '''''''''''''''''
    Join Date
    Mar 2003
    Location
    Germany
    Posts
    29
    Try this:

    PHP Code:

    $myfile
    =fopen("./infobox1.txt","w+"); //open the txt file
    fwrite($myfile$update); //write the contents to txt file
    fclose($myfile); //close the file
    echo "&infobox1=$update"// output the file's information 
    As $update is the text you want to write to a file
    you can't use it as a file handle.

    BTW you don't have to change the rights of a PHP script.
    It doesn't need execution rights.
    Last edited by MalteG; 04-27-2003 at 07:26 AM.
    Malte

  5. #5
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Originally posted by MalteG
    Try this:

    PHP Code:

    $myfile
    =fopen("./infobox1.txt","w+"); //open the txt file
    fwrite($myfile$update); //write the contents to txt file
    fclose($myfile); //close the file
    echo "&infobox1=$update"// output the file's information 
    As $update is the text you want to write to a file
    you can't use it as a file handle.

    BTW you don't have to change the rights of a PHP script.
    It doesn't need execution rights.
    I does need write permissions though.. Esp on a Win Server. I don't know how you'd set it though depends I suppose on the what server you are using. Check the Server docs.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center