Re: [PHP3] File Locking Question From: pnet <email protected>
Date: 09/30/98

At 8:37 AM 9/30/98, jellegiers <email protected> wrote:
>I don't understand why you'd want to write to this session_id file from both
>frames. I would say, that once such an id is created, it should just be read.

That is correct.
Perhaps I misstated the problem. The issue is that you could have multiple
processes if several users were accessing the cgi at the same time and you
have no way of knowing if whichever frame does the writing is not being
requested by more than one process.

>As far as I understand your question, you want to be able to pass a unique
>id to
>+
>each user accessing your pages, am I right?

Yes.

>
>If so, you could compose a unique id (PHP: uniq_id

Good idea!
I hadn't used this function before and couldn't understand the manual
description at first. But now I get it. This is much better than using a
file, and faster too.

>over to the client as a cookie or as a GET-parameter in the URL. But you
>wouldn't need to save it to a file.

Granted that there are various ways of saving state info.
I am trying to write a general purpose scripting tool that gives the user
the option of what persistence mechanism to use. Sometimes you don't want
to depend on cookies or databases that aren't available. Other times you
cannot, or don't want to, send any query_string; sometimes you can't use
hidden input fields either, so I am trying to include text files or dbm
files as alternate data-stores.

My plan was to use the session_id for a file name in which to store the
session state data. There is no file-locking problem there; my problem came
from trying to use a file to store a counter that would be incremented to
generate new session_ids. Bad idea.

>Another alternative in PHP is to use PHPLIB.

Yes I have looked at that but it is not quite what I want.

Thanks for your help.

- tppt: Tom Paine, Perpetual Traveller; webmaster <email protected>
================================================================
The USA has the highest incarceration rate in the world (1.6 m)
Most of those in prison are there for victimless 'crimes' (63%)
Since 1979, property seized without trial, has increased by 2500%
In the 'War On Drugs', drugs do not die. People do.

--
PHP 3 Mailing List   http://www.php.net/
To unsubscribe send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest list:  php3-digest-subscribe <email protected>
For help: php3-help <email protected>  Archive:  http://www.php.net/mailsearch.php3