Version: 1.30, by Billspaintball
Developer Last Online: Nov 2011
Version: 3.5.8
Rating:
Released: 11-16-2005
Last Update: 04-23-2007
Installs: 138
Additional Files
No support by the author.
Hack Description
This is a cutdown version of the user authentication and access control system I use on the non vB pages on my website.
This uses the vB 3.5 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 displying to non members only, and/or let members access to specific content.
Ive cut it down to the bare minimum that it needs to work, no fancy stuff such as avatars, PM's, or even formating.
I will try and offer support, but work and family commitments mean I dont have much free 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
vB 3.5.x - All Versions
Changelog
Version 1.30 (24th April 2007)
Fixed - // in paths bug
Fixed - Javascript warning in some browsers
Fixed - Tidied up some code
Version 1.20 (2nd December 2006)
Fixed Logout incorrect path bug
Made change to reduce compatibility problems with foreign scripts
Version 1.10 (4th Feb 2006)
Changed login_inc.php so you only need to edit path in one place now.
Added more commenting to login_inc.php
Added usage instructions to instructions file
Added troubleshooting guide with all common problems and fixes to instructions file.
Note: It is NOT necessary to update from 1.0 to 1.10.
There is no functionality changes or bug fixes between these 2 releases.
Version 1.0 (17th November 2005)
Initial Release
Deluxe Version of this hack is now available
Has Avatars, PM's, Number of Posts etc.
I'm trying to restrict access to pages based on Usergroups, but I can't figure out what I shoud do with the code you provided. I have tried it in different locations on the page, but whether I'm logged in or not it always shows me the page. Any help? (The user login works perfectly for me, btw.)
I'm trying to restrict access to pages based on Usergroups, but I can't figure out what I shoud do with the code you provided. I have tried it in different locations on the page, but whether I'm logged in or not it always shows me the page. Any help? (The user login works perfectly for me, btw.)
post a sample of your page and what you are trying to do, so we can have a look at it.
Right now I have it at the top of the page, and I'd like to restrict this page's access to those who attend here only. I've also tried replacing the 'Have stuff for here' with the content of the page, and that didn't work either. I realize I must be missing the obvious, but I'm just stumped at this point. Thanks for any help.
PHP Code:
<?php chdir('forums'); require_once('forums/global.php'); ?> <?php if ($vbulletin->userinfo['usergroupid'] == '9' ) { echo "Have stuff for here"; } else { echo "You do not have permission for this page"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
<body> <p align="center"><img src="images/memserv.gif" width="484" height="37" align="middle" /></p> <table width="80%" border="4" align="center" bordercolor="#999999" bgcolor="#FFFFFF"> <tr> <td><table width="100%" align="center"> <tr> <td width="50%" align="left" valign="top"><p>Welcome to the Richmond church of Christ Member Services area. Here you will find special areas and information specifically <em>for</em> members attending here in Richmond</p>
<?php
if ($vbulletin->userinfo['usergroupid'] == '9' )
{
echo "
<p align="center"><img src="images/memserv.gif" width="484" height="37" align="middle" /></p>
<table width="80%" border="4" align="center" bordercolor="#999999" bgcolor="#FFFFFF">
<tr>
<td><table width="100%" align="center">
<tr>
<td width="50%" align="left" valign="top"><p>Welcome to the Richmond church of Christ Member Services area. Here you will find special areas and information specifically <em>for</em> members attending here in Richmond</p>
} else {
echo "You do not have permission for this page"; }
?>
</body>
</html>
I havent tested the code cos Im at work.
I may have missed escaping a " somewhere (I have a habit of doing that) but you should get the idea of how it works.
That works great, but is there a way to set it for access from multiple usergroups? ie, Members are usergroup 9 and Admins are usergroup 6. I've tried it as
PHP Code:
if ($vbulletin->userinfo['usergroupid'] == '9' )
and
PHP Code:
if ($vbulletin->userinfo['usergroupid'] == '9,6' )
and
PHP Code:
if ($vbulletin->userinfo['usergroupid'] == '9','6' )