Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.5 > vBulletin 3.5 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.30, by Billspaintball Billspaintball is offline
Developer Last Online: Nov 2011 Show Printable Version Email this Page

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.

Click Here


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
  #122  
Old 03-22-2006, 10:36 AM
Snatch Snatch is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 124
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I get this Error

Code:
Notice: Undefined index: HTTP_REFERER in /var/www/web1/html/vb3/includes/class_core.php on line 1574
And this ist my index.php
PHP Code:
<?php
chdir
('/var/www/web1/html/vb3');  
require_once(
'/var/www/web1/html/vb3/global.php');  
?>
<html>  
<body>  
<?php
/************************************************\
 * File Uploader
 * **********************************************
 * File Name    : index.php
 * Author       : Tuan Do @ [url]www.celerondude.com[/url]
 * Email        : [email]dork@celerondude.com[/email]
 * Purpose      : load actions
\************************************************/

 
require_once('/var/www/web1/html/test/login_inc.php');
   
//-----------------------------------------------
// Initialize some stuff
//-----------------------------------------------
ob_start('ob_gzhandler');
error_reporting(E_ALL);
define('UPLOADER'1);

//-----------------------------------------------
// Require neccessary files and initialize objects
//-----------------------------------------------
require_once('includes/common.inc.php');
require_once(
'includes/template.class.php');
require_once(
'includes/functions.inc.php');
$Template = new Template('templates');
$Template->_cache 1;
$Template->_cache_dir 'cache/';
$start timer();


  
//-----------------------------------------------
// Load the settings file
//-----------------------------------------------
$Settings load_file($settings_file);


//-----------------------------------------------
// Files to include and the action
//-----------------------------------------------
$includes = array(
                    
'default'               => 'uploader.php',
                    
'login'                 => 'login.php',
                    
'logout'                => 'logout.php',
                    
'register'              => 'register.php',
                    
'lostpassword'          => 'lostpassword.php',
                    
'browse'                => 'browse.php',
                    
'viewfiles'             => 'viewfiles.php',
                    
'changepassword'        => 'changepassword.php',
                );
if( !isset(
$_GET['action']) || empty($_GET['action']) || !isset($includes[$_GET['action']]) )
{
    
$action 'default';
}
else
{
    
$action =& $_GET['action'];
}

//-----------------------------------------------
// Authenticate user
//----------------------------------------------- 
$banned [] = 'x.x.x.x';
$banned [] = 'x.x.x.x';
$banned [] = 'x.x.x';

if ( 
in_array $_SERVER['REMOTE_ADDR'], $banned ) )
{
    
show_message('Access Denied''Your IP address has been restricted from accessing this uploader.'1);

    
$Template->display('index.tpl');
    
    exit;
}
$logged_in 0;
if(
$Settings['password_required'] && $action != 'register' && $action != 'lostpassword' && $action != 'login&& $action != 'lostpassword')
{
    
session_start();
    if(!isset(
$_SESSION['uploader_username']))
    {
        if(isset(
$_COOKIE['uploader_userid']) && isset($_COOKIE['uploader_password']))
        {
            
$user authenticate_by_id($_COOKIE['uploader_userid'], $_COOKIE['uploader_password']);
            if(!
$user)
            {
                
$action 'login';
            }
            else
            {
                
$logged_in 1;
                
$current_user $user['username'];
                
$Template->assign('logged_in'1);
            }
        }
        else
        {
            
$action 'login';
        }
    }
    else
    {
        
$current_user $_SESSION['uploader_username'];
        
$logged_in 1;
        
$Template->assign('logged_in'1);
    }
}


//-----------------------------------------------
// Load action file.
//-----------------------------------------------
require( 'includes/' $includes[$action]);

//-----------------------------------------------
// Included files made changes to the template
// Now print everything
//-----------------------------------------------
if($Settings['password_required'] && !$logged_in)
{
    
$Template->assign('noheader'1);
}

$Template->assign('runtime'timer($start) );
$Template->display('index.tpl');
?>
</body>  
</html>
GreeTz
Snatch
Reply With Quote
  #123  
Old 04-06-2006, 01:15 AM
nestoras's Avatar
nestoras nestoras is offline
 
Join Date: Aug 2005
Location: Greece
Posts: 36
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i have just install this!
1 problem!
i have this too
i have done everything you say but no fix!
Reply With Quote
  #124  
Old 04-14-2006, 01:26 PM
Billspaintball's Avatar
Billspaintball Billspaintball is offline
 
Join Date: Sep 2003
Location: Bathurst, Au
Posts: 649
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry about the lack of support.
We have just had a new addition to the family 3 weeks ago and Ive been kinda busy.
Reply With Quote
  #125  
Old 04-14-2006, 01:32 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 Snatch
I get this Error
I think its almost certainly a conflict because of something else you have on the page.

Have you tried section 5 of the troubleshooting guide to rule out other scripts interfearing?
Reply With Quote
  #126  
Old 04-21-2006, 11:13 PM
Spinball's Avatar
Spinball Spinball is offline
 
Join Date: Feb 2002
Location: Telford, England
Posts: 705
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm having the same problems.
PHP Code:
<?php
   chdir
("/home/sites/avforums/public_html/forums");
   require_once(
'../forums/global.php');  
require_once(
'/home/sites/avplay/public_html/login_inc.php');
$allowed_userids "1";
$allowed_users explode(",",$allowed_userids);
if (!(
in_array($vbulletin->userinfo['userid'],$allowed_users))) {
   echo (
"<P align='center'>Sorry but you do not have permission to access this page.</P>");
   include (
"/home/sites/avplay/public_html/footer.php");
   exit();
}

chdir("/home/sites/avplay/public_html");
...avforums.com and avplay.com are both on the same server and AV Forrums has been set up with the cookie path being / and cookie domain being .avforums.com.

Keeps saying I'm not allowed in, and when I print_r $vbulletin->userinfo is returns a userd of 0.
Help!
Reply With Quote
  #127  
Old 04-22-2006, 04:56 AM
Billspaintball's Avatar
Billspaintball Billspaintball is offline
 
Join Date: Sep 2003
Location: Bathurst, Au
Posts: 649
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Have you tried just the sample code in "Troubleshooting - step 5" yet?
(refer to this post https://vborg.vbsupport.ru/showpost....98&postcount=2 )

If so, what happened?
Reply With Quote
  #128  
Old 04-22-2006, 07:38 AM
Spinball's Avatar
Spinball Spinball is offline
 
Join Date: Feb 2002
Location: Telford, England
Posts: 705
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Billspaintball
Have you tried just the sample code in "Troubleshooting - step 5" yet?
(refer to this post https://vborg.vbsupport.ru/showpost....98&postcount=2 )

If so, what happened?
Yep - the same happened. Using vB 3.5.4
PHP Code:
<?php 
chdir
('/home/sites/avforums/public_html/forums'); 
require_once(
'/home/sites/avforums/public_html/forums/global.php'); 
?> 
<html> 
<body> 
This is a heading<br /> 
This is some more stuff <br /> 
And another line<br /> 
You get the idea<br /> 
Just place stuff as you normally would with HTML<br /> 
I use CSS to style and position on my site fwiw<br /> 
<br /> 
How about we put the login box right under here?<br /> 
<br /> 
<?php 
    
require_once('/home/sites/avforums/public_html/login_inc.php'); 
print_r($vbulletin->userinfo);

?> 
</body> 
</html>
Uploaded to www.avforums.com it works perfectly. Uploaded to www.avplay.com it does not. I get the 'Thanks for loggin in' message followed by the login request.
The contents of $vbulletin->userinfo are not being filled when the script is on avplay.com.
Reply With Quote
  #129  
Old 04-23-2006, 11:11 AM
Billspaintball's Avatar
Billspaintball Billspaintball is offline
 
Join Date: Sep 2003
Location: Bathurst, Au
Posts: 649
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Im pretty sure its related to cookies somehow.

Do both your forums use the same cookie prefix?
Reply With Quote
  #130  
Old 04-23-2006, 11:21 AM
Spinball's Avatar
Spinball Spinball is offline
 
Join Date: Feb 2002
Location: Telford, England
Posts: 705
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Billspaintball
Im pretty sure its related to cookies somehow.

Do both your forums use the same cookie prefix?
I agree with you Bill. AVPplay.com is not a forum and there is no cookie manipulation on the website.
Reply With Quote
  #131  
Old 04-27-2006, 06:39 PM
Spinball's Avatar
Spinball Spinball is offline
 
Join Date: Feb 2002
Location: Telford, England
Posts: 705
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anyone got any ideas on this one? Can this hack work on a website on the same server but with a different domain?
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 09:06 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05070 seconds
  • Memory Usage 2,371KB
  • 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
  • (1)bbcode_code
  • (3)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
  • (2)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