Hello I've got a website. produced using php,mysql. I wish to set a restriction like.. only 10 user can login my website at same time. How do i do this type of an environment? any body knows the answer kindly assist me to..

Make use of a database table to keep the amount of drenched in customers but you have to develop a way of imposing a period limit on individuals customers. I recommend a area within the table which notes their last activity. Whenever a new user tries to login you have to apply some logic such as this (pseudocode):

if(<10users){
    login
} elseif(any of the users have no activity for 30 mins){
    remove that user and login
} else {
    inform user of no space
}

You should update the final activity whenever a drenched in user visits a brand new page.

Go educate yourself on periods in PHP, then write your personal session handler - the very first time like a learning exercise. Then write your personal session handler again, fixing all of the bugs out of your first attempt and including the ability to count active periods.

Observe that the standard behavior for session handlers would be that the session data continues despite the session has timed out - its as much as the garbage collector (and optionally the session loader) to obvious up session data that is stale.

i'd override php session handling and store user periods within the database. you'll find an easy tutorial here: http://world wide web.raditha.com/php/session.php

by doing this you can just see if you will find a lot more than 10 valid periods saved inside your database table. though you need to consider handling logouts and timeouts, as some standard timeout like half an hour may not work nicely inside your application.

If you would like 10 user drenched in your site, disable the login box if you will find a lot more than 10 customers drenched in.

This presume that you've a table within the db that records the customers which are drenched within the site. The login procedure will write a brand new line within the table. The logout procedure will remove it.

Simply count the amounts of rows within this table to look for the quantity of customers.

as clarified above you need to conserve a table that will store the amount of customers who drenched in,but whenever the consumer logs out then decrement that value....each time a new user logins increment that value by checking it with ur limit