Hello,
I have a question about how PHP handles multiple file reads/ writes.
I made a page containing a self-submitting form where the user can
type his name, topic and a text. When he submits the form, PHP reads
the .php file in a variable. It then processes it: adds the user
comments to the var and writes the modified file back to disk. Next
time the user opens the page (s)he sees te comments (s)he and others
added.
So what I have is a very simple 'Blog' without using a database. The
..php file is modifying itself every time a user submits something.
Questions[color=blue]
> What happens when 2 (or more) user simultaneously submit this form?
> What happens when user A submits a form and _while_ the server is processing the file (not having written yet the modifies file) user B submits his form?
> What happens when multiple users submit a form while the server is processing a submit?
> Does PHP keep track of who's first or do I have to build a locking mechanism to secure things?
> What are other pitfalls and security related issues using this approach I oversee?[/color]
This is just curiosity - I am not planning to create a fill fledged
ssystem using this technique. Just wondering, learning server side
webscripting.
Thanks a lot,
Marc
I have a question about how PHP handles multiple file reads/ writes.
I made a page containing a self-submitting form where the user can
type his name, topic and a text. When he submits the form, PHP reads
the .php file in a variable. It then processes it: adds the user
comments to the var and writes the modified file back to disk. Next
time the user opens the page (s)he sees te comments (s)he and others
added.
So what I have is a very simple 'Blog' without using a database. The
..php file is modifying itself every time a user submits something.
Questions[color=blue]
> What happens when 2 (or more) user simultaneously submit this form?
> What happens when user A submits a form and _while_ the server is processing the file (not having written yet the modifies file) user B submits his form?
> What happens when multiple users submit a form while the server is processing a submit?
> Does PHP keep track of who's first or do I have to build a locking mechanism to secure things?
> What are other pitfalls and security related issues using this approach I oversee?[/color]
This is just curiosity - I am not planning to create a fill fledged
ssystem using this technique. Just wondering, learning server side
webscripting.
Thanks a lot,
Marc
Comment