|
Posted by Dikkie Dik on 10/03/03 11:30
Joseph S. wrote:
> Hi,
> (1) I have about 8-9 .php files which are far from complex. I first
> used GET in all of them. Worked fine. Then I changed all method="get"
> to method="post" and $_GET to $_POST with search-replace, thinking that
> it should work, but, it seems the $_POST variables are not getting
> populated. Then I tried a simple one-page script using post - works
> fine. So what could be the problem? I am not using
> import_request_variables() or any such advanced feature.
Do you submit the forms or do you build up a query portion of a URL? The
post method needs a <FORM> tag with form elements. It should be
submitted. With the get method, you can just call a URL with a query
portion.
> (2) How do you address the situation where you have several
> simultaneous users of your web application and your script reads from
> the same single file, and maybe writes to the same single file(keep
> aside the case of poor design, I am talking of say a page hit counter,
> or reading initial settings from the single file), will not several
> copies of your code in memory reading the same file on disk cause
> problems? is there some specific code for such a situation? I looked
> for "threadsafe" and "multiple user" but could not get anything.
>
> Any help is appreciated.
> Joseph S.
>
There are database servers that have addressed the locking and
multi-user problems for you and there are also free webcounters
available on the web. But if you want to do it with a file, you could
try to achieve a file lock. Depending on the OS, you could either
directly lock the file or work with a separate lockfile. Both have the
disadvantage that if anything goes wrong, the counter file remains
locked until you unlock it by hand.
An alternative approach is to run an external application (by using COM
on Windows, for example) that is the only process to touch the file.
Your PHP scripts can then call the external application for both reading
and writing.
Best regards
Navigation:
[Reply to this message]
|