limi is that t number of user in account

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

limi is that t number of user in account

Post by yacahuma »

what will be the best way to do this?
There is an application that uses a username and password. The idea is to add the functionality to limit the number of users and also allow certain users to not use login at all. The reason is that one of the users is this application will be a library. So username and password for library users will not be created.


My idea.

I dont want to mess to much with the current application. So I will create a new page for the library. If the ip of the library does not change from machine to machine I will do something similar to this

//get user information from REMOTE_ADDR(table user_ip)

//get max_no_of_users from userid(table : user)

//get number of users in visitor table where the last update has not been made in 20 minutes(configurable) (table: visitor_login )

//if the number of active visitors >= max_no_of_users , do not allow login

//otherwise, create random username at add it to a visitor table.

//create user session with random username as if normally login, and update visitor_login in every page


table: visitor_login
userid (int)| random username(string) | lastupdate (timestamp)

table: user_ip
userid (int)| IP(string)

table: user
userdata(1 or more colums) | max_no_of_users(smalint)


Please let me know if there is a better way to do this.

When should I delete old entries if I dont want to user a cron?

phpbb shows when someone is logged. When phpbb decides that the person is not logged anymore?

Thank you
Post Reply