Skip to main content
JBWebWorks
Inspiring
October 19, 2009
Question

php code limit a user based on access level

  • October 19, 2009
  • 2 replies
  • 1371 views

building site where users post items for sale

different levels of access

want to limit basic access level to 10 postings

use php/mysql and dreamweaver CS4

thanks for your help,

jim balthrop

This topic has been closed for replies.

2 replies

Inspiring
October 20, 2009

Best way is to add a user_type field into the database table, this will hold the user type say "basic" user will only have access to certain parts of site.

Advanced can have access to all.

Add it to your query.

SELECT * FROM users WHERE user_type = 'basic'

DwFAQ
Participating Frequently
October 20, 2009

basic user inserts their post into a table. recordset of table finds out how many posts the users has made. your php code will then determine IF recordset for users total posts > 10 then no more posts are possible ELSE post is possible.

What is to prevent users from creating multiple accounts to post more than 10?

You're welcome.

JBWebWorks
Inspiring
October 20, 2009

thanks

so i would have the recordset with COUNT(*) >10 as part of the recordset; would the recordset go on the login user page and the IF count is >10 echo a statement to purchase a higher level?

would the recordset need to go on any other pages than just the login page?

anything i am missing?

Inspiring
October 20, 2009

The recordset should also go on the add page so that it checks that the user cannot add anymore without upgrading.

select * from user where user_type = 'basic'

do your count here

if user_type = basic {

do something here

e.g echo 'please upgrade your account. Click Here to upgrade';

}