indie wrote:
how to make a user management in php, i mean that i want to limit the user
access to my page. the script will not allow 2 user have an access to my
page at the same time. the script only allow 1 user to access the page.
the second user will have the queue massage. please help me ... :)
thank's before
indra
Sounds like a disaster waiting to happen. This sort of question tells me
you do not really grasped the concepts of what a web page/server really
is and how they actually work... Each "page" access is autonomous. In
other words, one does not, cannot know about the other because most
webservers are multi-threaded and can also have multiple servers
responding to multiple request concurrently. This would be like trying
to control the number of water molecules dripping from your faucet.
Now, if you can explain a bit more about what you are trying to achieve,
someone here may have already "been there/done that" and can give you
some pointers.
Two things I can think of would be to modify your server to only accept
one connection at time (in which case user 2-n will go elsewhere) or
check to see if a filename exists (like pagelock.txt - no data needs be
stored in it, merely does it exist) within a particular directory and if
not create it and if it does loop until it disappears, process work,
then delete the file. However, what happens if two people try to create
a file at the same time... who wins - because the other user also thinks
he created the file unless there are boatloads of status messages as to
the success or failure of the call to create the file, keeping in mind
that Unix and Windows will allow to "overwrite" an existing file. So
both processes will think they have created it and continue on. You can
really never say that this scenario can't happen, but in the real world,
it not only can happen, but probably will -- and how will that affect
your processing?
You need to reconsider the design rather than the "fix" for your little
problem.
Michael Austin.