Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19

Thread: Edit .txt file on server

  1. #11
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Thanks alot djr33! I got this to work *sigh of relief. Again, thanks alot
    - Mike

  2. #12
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Tiny problem: The following won't display the contents of the .txt file:

    Code:
    <?php
    $fc = file("file.txt");
    echo $fc;
    ?>
    It returns the value "Array" for some reason...
    - Mike

  3. #13
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    That's because it's an array of all the lines in the file. See the documentation for file(). You probably mean file_get_contents().
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #14
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    file_get_contents() doesn't put in escape characters

    I have \n written in the file to make a line, and it all appears as one string. How can this be fixed?
    - Mike

  5. #15
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Okay. (sorry for all the posting ) But it's done; it is a fully-functional comments page without a MySql database.
    http://mburt.mb.funpic.org/contact.php
    Fire at will
    - Mike

  6. #16
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I have \n written in the file to make a line, and it all appears as one string. How can this be fixed?
    That's not what's happening at all. Remember, you're outputting HTML. In HTML, linebreaks are treated as a space.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #17
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Yeah, I forgot. Kind of a stupid mistake. I changed my mind and made the file a .htm document so html tags could be valid in my code, but I used strip_tags() to make sure the user couldn't use html.
    - Mike

  8. #18
    Join Date
    Oct 2006
    Posts
    75
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    link's broken lol

  9. #19
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Okay... here's the new link :

    http://mburt.mb.funpic.org/guestbook.php
    - Mike

Bookmarks

Posting Permissions

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