Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Feb 2010
    Thanked 0 Times in 0 Posts

    help with activation/script

    Hi all,

    I have a members area, where users sign up using register.php, which then emails us to activate them. We will then log into our admin panel to activate any users not yet activated. Each user will only be allowed specific access to certain areas of the site i.e. if they own 2 products out of four they can only access support pages relating to those products. The access levels will be set when we activate the user. (have i lost you yet?)

    I have the majority of scripts working, the only bit i'm stumped with is the activation. Ideally, i'd like to retrieve all users from mysql db with the field activated=0 (so not activated) into a table, which i can do and have got set up. Then....

    This is where i get lost: i want to make a form for each user retrieved into the table above, with checkboxes for each area i want to allow them to, all within the same table and once submitted will activate each user at a time.

    Any ideas on the script? I can supply what i have now if needed?


  2. #2
    Regular Coder
    Join Date
    Dec 2009
    Thanked 58 Times in 58 Posts
    Once you pass all the id's back to php with the ones you want to activate, simply use
    UPDATE user_table_name SET active='true' WHERE user_id_field IN(1,2,3,4,5)
    replacing 1,2,3,4,5 with a list of id's. If you do this right, you can just implode the list of id's using a , as the glue, and then insert that into the string. Be sure to replace the column and table names with the correct ones. That one query will set all the id's in the braces to active
    My site: JayGilford.com
    PHP Pagination Class | Getting all page links | Handling PHP Errors properly
    If you like a users help, show your appreciation with the rep and thanks buttons :)


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts