updating an html page via a php script

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dave

    updating an html page via a php script

    Hello,
    I've got a page, actually a friend does, that he'd like to update with
    his schedule for the week. THis is a simple html page, and he'd like to do
    this via a php script. Ideally one would load the page, see a current week
    schedule if any, or nothing if there is none, and be able to add events.
    This should be as simple as possible and not require a database for this is
    simple text entry. I've fofilled part of this, i can open the index file,
    and write information to it, but i'm not sure how to lock the file so
    simultaneous writes can not occur and i do not know how o place the
    information in a specific area.
    Any help appreciated.
    Thanks.
    Dave.


  • jn

    #2
    Re: updating an html page via a php script

    "dave" <dmehler26@woh. rr.com> wrote in message
    news:HC36c.2358 5$8G2.11451@fe3 .columbus.rr.co m...[color=blue]
    > Hello,
    > I've got a page, actually a friend does, that he'd like to update with
    > his schedule for the week. THis is a simple html page, and he'd like to do
    > this via a php script. Ideally one would load the page, see a current week
    > schedule if any, or nothing if there is none, and be able to add events.
    > This should be as simple as possible and not require a database for this[/color]
    is[color=blue]
    > simple text entry. I've fofilled part of this, i can open the index file,
    > and write information to it, but i'm not sure how to lock the file so
    > simultaneous writes can not occur and i do not know how o place the
    > information in a specific area.
    > Any help appreciated.
    > Thanks.
    > Dave.
    >
    >[/color]

    Store the text in a text file, and use a script to edit the contents of the
    text file.

    Then instead of having a plain HTML page display the data, create it as a
    PHP page and include() the text file where ever the schedule goes. Or you
    can just use a server-side include in a normal HTML page if it is supported.

    You can even use flock() to keep multiple people from editing it at the same
    time.


    Comment

    • Chung Leong

      #3
      Re: updating an html page via a php script


      Uzytkownik "jn" <usenet*spamist ehsuckremovetor eply*@jasonnorr is.net> napisal
      w wiadomosci news:eh46c.2578 39$B81.3581425@ twister.tampaba y.rr.com...[color=blue]
      > "dave" <dmehler26@woh. rr.com> wrote in message
      > news:HC36c.2358 5$8G2.11451@fe3 .columbus.rr.co m...
      > Store the text in a text file, and use a script to edit the contents of[/color]
      the[color=blue]
      > text file.
      >
      > Then instead of having a plain HTML page display the data, create it as a
      > PHP page and include() the text file where ever the schedule goes. Or you
      > can just use a server-side include in a normal HTML page if it is[/color]
      supported.[color=blue]
      >
      > You can even use flock() to keep multiple people from editing it at the[/color]
      same[color=blue]
      > time.[/color]

      You can't keep a file lock between requests, so flocking won't prevent
      multile people from editing the same file. To do that you'd need to
      implement your own file-based locking mechanism, or go poke around PHP's
      session files.

      You can also approach the problem this way: Save the md5 of the file in a
      session variable, then check the md5 of the file again before overwriting it
      with the submitted content. If the md5s don't match, the user gets a error
      message, telling him/her that someone has modified the file.


      Comment

      • dave

        #4
        Re: updating an html page via a php script

        Hello,
        Thanks, i thought of that. I can't rename pages, or do anything with
        ssi's even though that would be easiest. I need to have like an input area
        on a form, where text is entered, then when a submit button is pushed the
        information is written to the indicated file. But i'm not sure how to get
        the information to a specific place in the file.
        Thanks.
        Dave.


        Comment

        • ®ed Eye Media - Richard Grove

          #5
          Re: updating an html page via a php script


          "dave" <dmehler26@woh. rr.com> wrote in message
          news:otc6c.2472 8$8G2.24385@fe3 .columbus.rr.co m...[color=blue]
          > Hello,
          > Thanks, i thought of that. I can't rename pages, or do anything with
          > ssi's even though that would be easiest. I need to have like an input area
          > on a form, where text is entered, then when a submit button is pushed the
          > information is written to the indicated file. But i'm not sure how to get
          > the information to a specific place in the file.
          > Thanks.
          > Dave.
          >
          >[/color]

          You need to have some server side stuff.
          Ideally PHP enabled webspace.
          Very easy of you have this.

          Ricgard Grove



          Comment

          • Garp

            #6
            Re: updating an html page via a php script


            "dave" <dmehler26@woh. rr.com> wrote in message
            news:HC36c.2358 5$8G2.11451@fe3 .columbus.rr.co m...[color=blue]
            > Hello,
            > I've got a page, actually a friend does, that he'd like to update with
            > his schedule for the week. THis is a simple html page, and he'd like to do
            > this via a php script. Ideally one would load the page, see a current week
            > schedule if any, or nothing if there is none, and be able to add events.
            > This should be as simple as possible and not require a database for this[/color]
            is[color=blue]
            > simple text entry. I've fofilled part of this, i can open the index file,
            > and write information to it, but i'm not sure how to lock the file so
            > simultaneous writes can not occur and i do not know how o place the
            > information in a specific area.
            > Any help appreciated.
            > Thanks.
            > Dave.[/color]

            He should start with a proper database, and stop trying to write one from
            scratch (which is what he's doing). Sooner or later, he's going to find more
            useful things to do with it and he'll end up rewriting bucket loads of code
            to handle databases instead of fiddling with text files and permissions.
            It's not even difficult, and it's a skill he can re-use over and over.

            Garp



            Comment

            Working...