![]() |
Simple vB User login and access control on non vB pages
1 Attachment(s)
Hack Description
This is a cut down version of the user authentication and access control system I use on the non vB pages on my website. This uses the vB 4.0 login system to log you in and out. It allows you to move between your forums and other pages on your site while remaining logged in. It allows you to do things such as restrict pages by usergroup, display different content depending on a user being logged in or not. For example, you can have banner Adds displaying to non members only, and/or let members access to specific content. I've cut it down to the bare minimum that it needs to work, no fancy stuff such as avatars, PM's, or even formating. (That is in the Deluxe version - not yet released) This is not supported, but if any questions / issues are posted here (not PM'ed or emailed) I will try and answer them if I have time. This code is a mix of my own, and pieces I have used from other hacks that are floating around. This script has been confirmed as working on
Change log Version 4.00 (15th November 2009)
Click on Install If you have this script installed then please click on the install link because;
|
Note - The following troubleshooting tips work on vB 3.7 & 3.8, they have not yet been proven on vB 4.0
Usage The hack is pretty useless without some usage instructions so here they are. We can use conditionals to hide or display depending on a number of things such as Logged in or out status, or restrict to members of a specific usergroup. We do this by using conditionals in php tags where the normal content of a webpage would go. If you want something only accessable to a certain usergroup, use this code in your webpage. This example is only visible to members of usergroup 6. PHP Code:
For example, PHP Code:
For example: PHP Code:
Another use is to display different content to users depending on if they are logged in or not. For example PHP Code:
For example PHP Code:
Troubleshooting If your reading this chances are you are having problems. Here are some common causes and fixes.
|
thaanks
reserved |
Reserved till i get my site up. I have been waiting for this. Glad it wasnt long! :)
|
Is this correct or a typo -
PHP Code:
Where do we put the login_inc file included with this hack? Any special directory, or whichever directory we are running the script? Thanks. :) *Edit - Also, do these statements work with the new VB code? PHP Code:
|
Quote:
And the statements do work. However I do have an issue. I can't use the statements twice. Not sure what is going on but if I used the statement once, it doesn't work to use it again. |
Quote:
Sorry about that, its just a typo. login_inc.php is correct. I will fix it. Quote:
I normally just put it under something like mywebside.com/includes/ |
Your example code:
PHP Code:
untested: PHP Code:
|
Quote:
Ive only ever used it to allow extra stuff for Admins and Mods so I never really had a need to optimise it for a large number of groups. |
Im getting this error -
Code:
Unable to add cookies, header already sent. |
All times are GMT. The time now is 11:49 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|