Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.6 > vBulletin 3.6 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Simple vB User login and access control on non vB pages Details »»
Simple vB User login and access control on non vB pages
Version: 1.10, by Billspaintball Billspaintball is offline
Developer Last Online: Nov 2011 Show Printable Version Email this Page

Category: Integration with vBulletin - Version: 3.6.5 Rating:
Released: 12-01-2006 Last Update: 04-23-2007 Installs: 197
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.6 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.6
  • vB 3.6.1
  • vB 3.6.2
  • vB 3.6.3
  • vB 3.6.4
  • vB 3.6.5


Changelog

Version 1.10 (24th April 2007)
  • Fixed - // in paths bug
  • Fixed - Javascript warning in some browsers
  • Fixed - Tidied up some code

Version 1.0 (2nd December 2006)
  • Very similar to my vB 3.5 version, however logout bug fixed and should be more compatible with other scripts on your page.



Click on Install
If you have this script installed then please click on the install link because;
  • You will get notified if any security issues are reported.
  • You will get notified when there are any upgrades to this script
  • It gives me a warm fuzzy feeling and motivates me to develop more

Donations
First of all, to be clear. This script is 100% free.

However if you feel an urge to donate I'm not going to say no.
Donations can be made at http://www.billspaintball.com/vb3/bd_donate.php

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #42  
Old 02-20-2007, 02:34 AM
djbaxter djbaxter is offline
 
Join Date: Aug 2006
Location: Ottawa, Canada
Posts: 2,601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Uninstall vBSEO.
Reply With Quote
  #43  
Old 02-20-2007, 04:05 AM
Billspaintball's Avatar
Billspaintball Billspaintball is offline
 
Join Date: Sep 2003
Location: Bathurst, Au
Posts: 649
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Mastar View Post
How to get this to work wid vbseo?
Code:
Unable to add cookies, header already sent.
File: /home/XXXXX/public_html/index.php
Line: 1
 

 



Search Engine Optimization by vBSEO 3
Usually means you have some white space up the top of your page.

Post the first few lines of that page so we can see whats happening.
Reply With Quote
  #44  
Old 02-20-2007, 04:26 PM
Skeezster Skeezster is offline
 
Join Date: May 2003
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi,

I'm trying to use this in a page which contains other variables, but they're all being wiped. I've done some general reading on the VBulletin variable cleaning utility, but can't for the life of me figure out what I'm doing wrong.

Basically an "id" variable is passed (using the "request" function) with the URL for a simple news script (news.php?action=viewnews&id=5)
But with global.php (thus init.php) being used the variable is being wiped. How can I get around that?

Code:
	switch($_REQUEST['action']) {
    case 'viewnews':
	     viewNews($id);
		 break;
}

Thanks
Reply With Quote
  #45  
Old 02-20-2007, 05:32 PM
Skeezster Skeezster is offline
 
Join Date: May 2003
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nevermind, I discovered just how stupid I was being!
Reply With Quote
  #46  
Old 02-20-2007, 11:08 PM
Billspaintball's Avatar
Billspaintball Billspaintball is offline
 
Join Date: Sep 2003
Location: Bathurst, Au
Posts: 649
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Skeezster View Post
Hi,

I'm trying to use this in a page which contains other variables, but they're all being wiped.
At a guess your using the same variable names that vB uses.
Reply With Quote
  #47  
Old 02-21-2007, 01:40 AM
Skeezster Skeezster is offline
 
Join Date: May 2003
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I ended up putting the variable through the vbulletin variable cleaner which sorted things out nicely.

I'm able to log-in and out fine from any page with the includes, but when I attempt to use the user's name/id in the page then I don't get any result. I'm using the following code in the page:
Code:
		$member_name = $vbulletin->userinfo['username'];
		echo 'Hello there ' . $member_name;
And this is up at the top of the page:
Code:
<?php
$curdir = getcwd ();
chdir('/home/######/public_html/forum');
require_once('global.php');
chdir ($curdir);
include 'db.php';
global $db;
?>
Reply With Quote
  #48  
Old 02-21-2007, 01:59 AM
Skeezster Skeezster is offline
 
Join Date: May 2003
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Found the problem - it doesn't like being inside a function. Think I'm sorted now!
Reply With Quote
  #49  
Old 02-21-2007, 02:52 AM
SocomNego SocomNego is offline
 
Join Date: Dec 2006
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok well I keep on getting an error...here it is

Quote:
Fatal error: Call to a member function on a non-object in /home/gamesoga/public_html/forums/includes/functions.php on line 1154
Here is my functions.php file from line 1154 to 1174
PHP Code:
    $user $vbulletin->db->query_first_slave("
        SELECT " 
.
            
iif(($option 16), ' administrator.*, ') . "
            userfield.*, usertextfield.*, user.*, UNIX_TIMESTAMP(passworddate) AS passworddate,
            IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid" 
.
            
iif(($option 2) AND $vbulletin->options['avatarenabled'], ', avatar.avatarpath, NOT ISNULL(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline, customavatar.width AS avwidth, customavatar.height AS avheight').
            
iif(($option 8), ', customprofilepic.userid AS profilepic, customprofilepic.dateline AS profilepicdateline, customprofilepic.width AS ppwidth, customprofilepic.height AS ppheight') .
            
iif(($option 32), ', sigpic.userid AS sigpic, sigpic.dateline AS sigpicdateline, sigpic.width AS sigpicwidth, sigpic.height AS sigpicheight') .
            
iif(!isset($vbphrase), fetch_language_fields_sql(), '') . "
            
$hook_query_fields
        FROM " 
TABLE_PREFIX "user AS user
        LEFT JOIN " 
TABLE_PREFIX "userfield AS userfield ON (user.userid = userfield.userid)
        LEFT JOIN " 
TABLE_PREFIX "usertextfield AS usertextfield ON (usertextfield.userid = user.userid) " .
        
iif(($option 2) AND $vbulletin->options['avatarenabled'], "LEFT JOIN " TABLE_PREFIX "avatar AS avatar ON (avatar.avatarid = user.avatarid) LEFT JOIN " TABLE_PREFIX "customavatar AS customavatar ON (customavatar.userid = user.userid) ") .
        
iif(($option 8), "LEFT JOIN " TABLE_PREFIX "customprofilepic AS customprofilepic ON (user.userid = customprofilepic.userid) ") .
        
iif(($option 16), "LEFT JOIN " TABLE_PREFIX "administrator AS administrator ON (administrator.userid = user.userid) ") .
        
iif(($option 32), "LEFT JOIN " TABLE_PREFIX "sigpic AS sigpic ON (user.userid = sigpic.userid) ") .
        
iif(!isset($vbphrase), "LEFT JOIN " TABLE_PREFIX "language AS language ON (language.languageid = " . (!empty($languageid) ? $languageid "IF(user.languageid = 0, " intval($vbulletin->options['languageid']) . ", user.languageid)") . ") ") . "
        
$hook_query_joins
        WHERE user.userid = 
$userid
    "
); 

I have tried to check it out, but I don't have a clue what it could be...
Any help would be much appreciated!!!
Reply With Quote
  #50  
Old 02-22-2007, 03:02 AM
Billspaintball's Avatar
Billspaintball Billspaintball is offline
 
Join Date: Sep 2003
Location: Bathurst, Au
Posts: 649
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There should be nothing wrong with the functions.php file, the problem will be in the page that has called it.

Have you followed the steps in the troubleshooting guide? https://vborg.vbsupport.ru/showpost....79&postcount=2
Including step 5 with the test code.

If you still have problems after this, please post the first few lines of the page you are trying to use this hack on.
Reply With Quote
  #51  
Old 02-23-2007, 12:19 PM
HoG HoG is offline
 
Join Date: May 2006
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is it possible to redirect back to the page you accessed the login form from? if so can someone please give me the code to edit?

Thnx
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:44 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
  • Page Generation 0.04562 seconds
  • Memory Usage 2,337KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (4)bbcode_code
  • (1)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete