473,624 Members | 2,323 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to limit the user access to the page

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

Jul 17 '05 #1
7 2727
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.
Jul 17 '05 #2
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 ... :)


Not exactly something easily done through the web. I have a couple ideas
that may work, but you'd be better off doing this through some kind of
Java applet. Anything that doesn't talk to both the server and client
machines in real time will pose quite a few problems with timeouts and
page locks.

--
Justin Koivisto - sp**@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.
Jul 17 '05 #3
Hi Indie, Hi Micheal,

Interesting puzzle.

Michael Austin wrote:
keeping in mind
that Unix and Windows will allow to "overwrite" an existing file.


I guess Unix won't do that if the file is still open for writing.

Now if the first process first tries to open file 1 for writing and
keeps it open, then checks for file 2 to exist. If it does not, it it
creates it. Then closes file 1.

If a second process tries to do the same at aprrox. the same time, it
should either get an error for file 1 to be open for writing by an other
process, or it should find file 2 to exist.

But maybe this is overkill, it's like two phase commit, that is used for
distibuted transactions. Maybe your data is in a single database. If you
use a database that supports transactions, you should be able to SELECT
the page's record FOR UPDATE and set a boolean in its 'locked' column
and COMMIT WORK without have to worry about another process trying to do
the same at approx the same time. Newer MySQL for example versions
support this if you use the right type of table. You may have to set a
transaction isolation level to the database or table. OK, this may after
all be more complicated then those files, but OTOH, you may learn a
thing or two about transaction isolation, commit and rollback.

Greetings,

Henk Verhoeven,
www.phpPeanuts.org.

P.S. There can be a similar problem with the back key of the browser,
caching and proxies. It may prove impossible to make sure the page is
not reshown from a cache. And are you sure the form can not sucessfully
be resubmitted after an other user has established a lock?

Jul 17 '05 #4
actually i made teleoperation system that controlling my servo motor from
remote area. ofcourse only 1 user have an access for that, and the second
user can't will not have it.if both of them have an access at the same
time, my motor will "confuse" and can't move properly.

Jul 17 '05 #5
Nel
"indie" <in***@plaza.ne t> wrote in message
news:a5******** *************** *******@localho st.talkaboutpro gramming.com...
actually i made teleoperation system that controlling my servo motor from
remote area. ofcourse only 1 user have an access for that, and the second
user can't will not have it.if both of them have an access at the same
time, my motor will "confuse" and can't move properly.


Give each on-line user a UID and store them in a table.

(Table structure: id, userid, incontrol, updated)

Each time the page loads check "incontrol" . If all set to FALSE then output
a button on the control page to allow a user to take control.
Check when posted that all "incontrol" are all still set to FALSE, then set
the active user to incontrol = TRUE.

If current user is incontrol then output a button to allow the user to
relinquish control (incontrol = FALSE)

"updated" as a timestamp will allow you to delete any users that are
inactive for a while, (stops someone taking control indefinitely).

That's about it.
Nel.
Jul 17 '05 #6
"Nel" <ne***@ne14.co. NOSPAMuk> wrote in message news:<40******* *************** *@ptn-nntp-reader04.plus.n et>...
"indie" <in***@plaza.ne t> wrote in message
news:a5******** *************** *******@localho st.talkaboutpro gramming.com...
actually i made teleoperation system that controlling my servo motor from
remote area. ofcourse only 1 user have an access for that, and the second
user can't will not have it.if both of them have an access at the same
time, my motor will "confuse" and can't move properly.


Give each on-line user a UID and store them in a table.

(Table structure: id, userid, incontrol, updated)

Each time the page loads check "incontrol" . If all set to FALSE then output
a button on the control page to allow a user to take control.
Check when posted that all "incontrol" are all still set to FALSE, then set
the active user to incontrol = TRUE.

If current user is incontrol then output a button to allow the user to
relinquish control (incontrol = FALSE)

"updated" as a timestamp will allow you to delete any users that are
inactive for a while, (stops someone taking control indefinitely).

That's about it.
Nel.


Nel,
You explained it, but from the original post I am NOT sure they can
understand what is needed. Truth be told, I don't think the original
user is even checking this site to see if their question is being
answered...

BUT if they are...
The way I would try to explain it is like this.

You need a permanent db/file-based option for what you want.
You need someway for THAT page to check to see if someone else has it
opened.
Every time that page opens, it should check.
"Am I already opened?
If I am already opened, then don't open for this new guy.
If I am NOT opened, then open and note in the db/file that I am now
opened.
If I am already opened? I should also check:
How long have I been opened?
If I have been opened longer than allowed, then note in the db/file
and close.
If I have been opened less than I am allowed, stay opened."

THAT should cover it...
I think...

I just recently started work on a personal CMS.
The User Authentication is the hardest part.
How do you register users as still signed in?
Difficult, but not impossible.
I finished my user authentication and am now working on HTML
generation!
Yeah!
Jul 17 '05 #7
thank's guys

Jul 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
4876
by: Mike A | last post by:
Hi, I'm hoping someone can help me with this. I have a URL for which I'd like to limit access to by time. For example,say I have a URL that I don't want accessable on Monday mornings between 10am-noon and Fri. afternoons between 2-4pm. So when someone clicks on the URL during those times a message pops up saying somthing like "sorry we're closed now etc" Is this possible? if yes, I'm guessing I'll need somesort of "onclick" for the
12
2196
by: Ann D. | last post by:
Hi! I'm creating a website that has a few pages... question is, how can I prevent a user from going directly to a page. i.e. user has to go through myPage1.asp (page takes some user info) to get to myPage2.htm. I don't want the user to be able to get to myPage2.htm without going through the questionnaire on myPage1.asp. How can I do this? Thanks,
5
2652
by: Mitchell Thomas | last post by:
I am using Oracle as a backend and have a field set as Varchar2(2000). The problem i have is access interprets this as a memo field and allows the user to type more than 2000 characters but does not store the excess characters beyond 2000, giving the user the false sense of security that what they are typing beyond 2000 characters is being saved, which is not the case. I want to prevent the user from typing more than 2000. How do i do...
6
12348
by: Hannu | last post by:
Hi. In the ldb file you can see the users of the mdb-file. If you open the mdb-file your machine and username will be written in the lbd- file. Allthough you close the mdb-file your name won't disappear from the ldb-file, before every user has closed the mdb-file. I have heard that there will be problems if the amount of users will be over 10 in mdb-files. Is that true? Hannu
5
10187
by: Nosferatum | last post by:
I am in need of a solution on how to solve this problem: I need to limit access to six different folders. My users are validated in a system which check their prescence with a couple of variables in a db and then forwards them if they exist. Based upoen their status they are redirected to one of six folders. Users belonging to group A shall get access to folder A, but not B, C etc. It must be possible to limit access in this order by...
2
51561
by: Bob | last post by:
Hi all, My databases seem to become corrupted as soon as they reach 2GB. Once it does become corrupted the only fix is to create a new database and transfer everything into that. I need to avoid that happening and I'm not sure exactly how to do that. Is there a way that I can check the size of the database (don't know how) and then remove obselete tables (know how to) if its over a threshold and then compact and repair the db (know...
6
2989
by: Nosferatum | last post by:
Hi, on my Apache server I want to limit access to a certain file ouput (from php/MySQL) to just one IP. The idea is that users from another site should click a link whic redirects them to my special page on my server. Only those who access my page from one particulary URL are allowed to see my file. All others are denied. Is it possible to solve this with a .htaccess file, or do I need a php solution?
10
2469
by: Drew | last post by:
I am trying to limit access to certain pages on our intranet, and have been using the following code to do so, dim Login, L, LL, StringLen, NTUser Set Login = Request.ServerVariables("LOGON_USER") L=Len(Login) LL=InStr(Login, "\") StringLen=L-LL NTUser = (Right(Login, StringLen))
4
4000
dlite922
by: dlite922 | last post by:
hey guys, I'm doing some brain storming and getting ideas to come up with a solution. I have a list of ....data... that is displayed 10 per page with the LIMIT clause. Simply put: My requirement is to jump to the page a particular record is on from a search criteria. For example, if I'm going to get to record "John", I want to go to the page that John falls on if the list was sorted by primary/id, so that the user can still click...
0
8177
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8681
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8629
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8341
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8488
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7170
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4084
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2611
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.