943,795 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 1289
  • PHP RSS
Apr 8th, 2008
0

Restrict access based on activation

Expand Post »
Right now the site I am working on has a restrict access set up for two levels, but the way they set up their registration, once someone registers, they can login to the member side without first being activated in the database. I'd like to be able to adjust the restriction kind of like a where clause, where activation= 1 or something to that effect. Is this possible or does anyone have any advice or help for me? Thanks.
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
mgn2683 is offline Offline
63 posts
since Dec 2007
Apr 8th, 2008
0

Re: Restrict access based on activation

When the user registers, set the value for activation column as 0 (for that user) in the user table. When the user activates, update activation column to 1 for that user. Then, when the user tries to log in, while checking for username and password, also check if activation=1. If it isn't 1, promt him to activate first.
Moderator
Featured Poster
Reputation Points: 524
Solved Threads: 356
Purple hazed!
nav33n is offline Offline
3,878 posts
since Nov 2007
Apr 8th, 2008
0

Re: Restrict access based on activation

like nav33n said, and use sessions to store activation and add as include on each page.
Last edited by unabomber1; Apr 8th, 2008 at 10:56 am.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
unabomber1 is offline Offline
3 posts
since Apr 2008
Apr 8th, 2008
0

Re: Restrict access based on activation

I'm using ADDT to do this, when I click on the Restrict Access under Server Behaviors, where would I go to add activation=1 and the sessions ? Thanks.
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
mgn2683 is offline Offline
63 posts
since Dec 2007
Apr 8th, 2008
0

Re: Restrict access based on activation

Can you be more specific ? If you post your code and the database structure, it will be easier for us to help you !
Moderator
Featured Poster
Reputation Points: 524
Solved Threads: 356
Purple hazed!
nav33n is offline Offline
3,878 posts
since Nov 2007
Apr 8th, 2008
0

Re: Restrict access based on activation

The database is Mysql, and is working with a User table.

PHP Syntax (Toggle Plain Text)
  1. //Start Restrict Access To Page
  2. $restrict = new tNG_RestrictAccess($conn_nscar, "../");
  3. //Grand Levels: Level
  4. $restrict->addLevel("0");
  5. $restrict->Execute();
  6. //End Restrict Access To Page
  7.  
  8. // Start trigger
  9. $formValidation = new tNG_FormValidation();
  10. $formValidation->addField("kt_login_user", true, "text", "", "", "", "");
  11. $formValidation->addField("kt_login_password", true, "text", "", "", "", "");
  12. $tNGs->prepareValidation($formValidation);
  13. // End trigger
  14.  
  15. // Make a login transaction instance
  16. $loginTransaction = new tNG_login($conn_nscar);
  17. $tNGs->addTransaction($loginTransaction);
  18. // Register triggers
  19. $loginTransaction->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "kt_login1");
  20. $loginTransaction->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);
  21. $loginTransaction->registerTrigger("END", "Trigger_Default_Redirect", 99, "{kt_login_redirect}");
  22. // Add columns
  23. $loginTransaction->addColumn("kt_login_user", "STRING_TYPE", "POST", "kt_login_user");
  24. $loginTransaction->addColumn("kt_login_password", "STRING_TYPE", "POST", "kt_login_password");
  25. $loginTransaction->addColumn("kt_login_rememberme", "CHECKBOX_1_0_TYPE", "POST", "kt_login_rememberme", "0");
  26. // End of login transaction instance

Thanks for your help
Last edited by peter_budo; Apr 8th, 2008 at 7:30 pm. Reason: Keep It Organized - please use [code] tags
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
mgn2683 is offline Offline
63 posts
since Dec 2007
Apr 8th, 2008
0

Re: Restrict access based on activation

Umm.. Sorry ! I don't understand what exactly your code does.. But, you can do it as I have said in my previous post.
Moderator
Featured Poster
Reputation Points: 524
Solved Threads: 356
Purple hazed!
nav33n is offline Offline
3,878 posts
since Nov 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: PHP Variable in mySQL query
Next Thread in PHP Forum Timeline: problem in $_SESSION





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC