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
  #52  
Old 02-23-2007, 06:34 PM
PnL PnL is offline
 
Join Date: Dec 2004
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

HoG - this always redirects me back to the page from which our members log in.

QUESTION: How do I manipulate the size of the "Log In" button? I'd like to be able to streamline this hack so it fits neatly in a small area, and the button is quite large right now - can I adjust the size of it?
Reply With Quote
  #53  
Old 02-23-2007, 07:44 PM
SocomNego SocomNego is offline
 
Join Date: Dec 2006
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Billspaintball View Post
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.
Ok here is my code....The funny thing is that I have it on my home page and it works, but on this page it doesn't work even though I set it up the same way....

PHP Code:
<?php
   chdir
('/home/gamesoga/public_html/forums'); 
   require_once(
'/home/gamesoga/public_html/forums/global.php');  
?>

 
<?
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;
?>
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 3.2 Final//EN'>
<HTML><HEAD>
<META NAME='Generator' CONTENT='Texpad 4'>
<TITLE></TITLE>
<STYLE type='text/css'>
<!--
BODY{
CURSOR: default;
FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
FONT-SIZE: 12px;
COLOR: #FFFFFF;
BACKGROUND: #000044;
MARGIN-LEFT: 0px;
MARGIN-RIGHT: 0px;
MARGIN-TOP: 0px;
MARGIN-BOTTOM: 0px;
MARGIN-WIDTH: 0px;
MARGIN-HEIGHT: 0px;
SCROLLBAR-FACE-COLOR: #333399;
SCROLLBAR-HIGHLIGHT-COLOR: #000000;
SCROLLBAR-SHADOW-COLOR: #000000;
SCROLLBAR-3DLIGHT-COLOR: #000044;
SCROLLBAR-ARROW-COLOR: #000000;
SCROLLBAR-TRACK-COLOR: #000033;
SCROLLBAR-DARKSHADOW-COLOR: #000000
}
A{
COLOR: #FFFFFF;
TEXT-DECORATION: none
}
A:VISITED{
COLOR: #FFFFFF;
TEXT-DECORATION: none
}
A:HOVER{
COLOR: #FF0000;
TEXT-DECORATION: none
}
A:ACTIVE{
COLOR: #FFFFFF;
TEXT-DECORATION: none
}
UL{
FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
FONT-SIZE: 12px
}
LI{
FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
FONT-SIZE: 12px
}
P{
FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
FONT-SIZE: 12px
}
TD{
FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
FONT-SIZE: 12px
}
TR{FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
FONT-SIZE: 12px
}
SELECT    {COLOR: #51485F; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; FONT-SIZE: 10px}
INPUT     {COLOR: #51485F; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; FONT-SIZE: 10px}
TEXTAREA  {COLOR: #51485F; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; FONT-SIZE: 10px}
OPTION    {COLOR: #51485F; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; FONT-SIZE: 10px}
FORM      {FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; FONT-SIZE: 10px}
.loginforma{
COLOR: #FFFFFF;
border-width: 1;
border-color: #000000;
BACKGROUND-IMAGE: url('<? echo"$url[curtheme]"; ?>/images/loginforma.gif')
}
.loginformb{
COLOR: #FFFFFF;
border-width: 1;
border-color: #000000;
BACKGROUND-IMAGE: url('<? echo"$url[curtheme]"; ?>/images/loginformb.gif')
}
.loginformc{
border-width: 0;
border-color: #000000;
width:34px; 
height:19px;
BACKGROUND-IMAGE: url('<? echo"$url[curtheme]"; ?>/images/loginformc.gif')
}

.catfont{
color: #FF9900;
}
.altcolor{
background: #3a4466;
}
.altcolora{
background: #000033;
}
.altcolorb{
background: #000020;
}
.altcolorc{
background: #000020;
}

-->
</STYLE>
<?
echo($out[header]);
?>

<SCRIPT LANGUAGE='JavaScript'>
function ugcorgy() {
if (parent != self)
  top.location.href = self.location.href
}
</SCRIPT>

</head>

<body onload='javascript:ugcorgy()'>



<table width='100%' height='100%' valign='top' border='0' bordercolor='#000000' cellspacing='0' cellpadding='0'>
<tr>
<td width='100%' height='90' valign='top' align='center' colspan='2'>

<table width='100%' height='90' align='left' border='0' bordercolor='#000000' cellspacing='0' cellpadding='0'>
<tr>
<td width='305' height='55' valign='top' align='left' class='menu'>
<img src='<? echo"$url[curtheme]"; ?>/images/header_upper.gif' border='0'></a><br>
<img src='<? echo"$url[curtheme]"; ?>/images/header_lower.gif'></td>

<td width='100%' height='90' valign='top' align='left' background='<? echo"$url[curtheme]"; ?>/images/top_bg.gif'>
&nbsp;</td>

<td width='10' height='90' valign='top' align='left'>
<img src='<? echo"$url[curtheme]"; ?>/images/top_menu_a.gif'></td>
<td width='13' height='90' valign='top' align='left'>
<img src='<? echo"$url[curtheme]"; ?>/images/top_menu_c.gif'></td>

<td width='10' height='90' valign='top' align='left' background='<? echo"$url[curtheme]"; ?>/images/top_bg.gif'>
&nbsp;</td>

<td width='10' height='90' valign='top' align='left'>
<img src='<? echo"$url[curtheme]"; ?>/images/top_menu_a.gif'></td>
<td width='*' height='90' valign='top' align='left' background='<? echo"$url[curtheme]"; ?>/images/top_menu_b.gif'>



<?php
   
require_once('/home/gamesoga/public_html/login_inc2.php');
?>


</td>
<td width='13' height='90' valign='top' align='left'>
<img src='<? echo"$url[curtheme]"; ?>/images/top_menu_c.gif'></td>


<td width='10' height='90' valign='top' align='left' background='<? echo"$url[curtheme]"; ?>/images/top_bg.gif'>
&nbsp;</td>

<td width='10' height='90' valign='top' align='left'>
<img src='<? echo"$url[curtheme]"; ?>/images/top_menu_a.gif'></td>
<td width='13' height='90' valign='top' align='left'>
<img src='<? echo"$url[curtheme]"; ?>/images/top_menu_c.gif'></td>


</tr>
</table>

</td>
</tr>
<tr>
<td width='175' height='100%' valign='top' align='left' background='<? echo"$url[curtheme]"; ?>/images/left_bg.gif'>

<table width='175' height='100%' align='left' border='0' cellspacing='0' cellpadding='0'>


<?
echo($out[menu]);
?>


<tr>
<td width='175' height='*' valign='top' align='left'>
&nbsp;</td>
</tr>
</table>


</td>
<td width='100%' height='100%' valign='top' align='left'>


<!-- BODY START -->

<?
echo($out[body]);
?>

<br></td>

</td>
</tr>
<tr>
<td width='100%' height='50' valign='left' align='bottom' colspan='2' background='<? echo"$url[curtheme]"; ?>/images/bottom_bg.gif'>

<table width='100%' height='50' align='left' border='0' cellspacing='0' cellpadding='0'>
<tr>

<td width='325' height='50' valign='bottom' align='center'>
<img src='<? echo"$url[curtheme]"; ?>/images/bottom_left_corner.gif'></td>


<td width='5%' height='50' valign='bottom' align='center'>
&nbsp;</td>

<td width='10' height='50' valign='left' align='center'>
<img src='<? echo"$url[curtheme]"; ?>/images/bot_menu_a.gif'></td>

<td width='400' height='50' valign='center' align='center' background='<? echo"$url[curtheme]"; ?>/images/bot_menu_b.gif'>

<?
/*
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$endtime = $mtime;
$totaltime = ($endtime - $starttime);
printf("<center><font size='-2' color='#FFFFFF'>This page created in %f seconds</font></center>", $totaltime);
*/
?>
</td>


<td width='10' height='50' valign='bottom' align='center'>
<img src='<? echo"$url[curtheme]"; ?>/images/bot_menu_c.gif'></td>

<td width='*' height='50' valign='bottom' align='center'>
&nbsp;</td>

</tr>
</table>

</td>
</tr>
</table>
</body>
</html>
Reply With Quote
  #54  
Old 02-26-2007, 04:13 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 HoG View Post
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
It should do that automaticly.
Reply With Quote
  #55  
Old 02-26-2007, 04:16 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 PnL View Post
HoG - this always redirects me back to the page from which our members log in.

QUESTION: How do I manipulate the size of the "Log In" button? I'd like to be able to streamline this hack so it fits neatly in a small area, and the button is quite large right now - can I adjust the size of it?
In the file
login_inc.php
find the line with
// You can style this with html or CSS as normal if desired.
and you will see the login form code.
You can make the boxes smaller by editing
size=10
and/or you can add css or html tags to format the text size/colour/font etc as desired.
Reply With Quote
  #56  
Old 02-26-2007, 04:21 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 SocomNego View Post
Ok here is my code....The funny thing is that I have it on my home page and it works, but on this page it doesn't work even though I set it up the same way....

PHP Code:
<?php
   chdir
('/home/gamesoga/public_html/forums'); 
   require_once(
'/home/gamesoga/public_html/forums/global.php');  
?>

Try changing that bit above to
<?php
$curdir = getcwd ();
chdir('/home/gamesoga/public_html/forums');
require_once('/home/gamesoga/public_html/forums'/global.php');
chdir ($curdir);
?>

If that does not work I suspect that your trying to use a variable named the same as a reserved vB one.
Reply With Quote
  #57  
Old 02-26-2007, 05:14 PM
DaveS DaveS is offline
 
Join Date: Apr 2006
Posts: 49
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Does this mod allow me to use the vB headers and footers?
Reply With Quote
  #58  
Old 02-26-2007, 09:23 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 DaveS View Post
Does this mod allow me to use the vB headers and footers?
I dont know.
I havent looked into whats involved in calling the vB header and footer templates.
Reply With Quote
  #59  
Old 02-28-2007, 04:17 PM
abenoking abenoking is offline
 
Join Date: Sep 2006
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Many thanks. This snippet allowed me to do something that I've been begging for support on vb.org for the past several months. Plus, it is super-easy to modify and customize.

My only question, is if you have a complete list of $vbulletin->userinfo[] variables that I can use in conjunction with this mod.
Reply With Quote
  #60  
Old 03-01-2007, 01:02 PM
jasbell jasbell is offline
 
Join Date: Feb 2007
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is probably a common request/hack so that is why I am describing what I have done.

I took Billspaintball's script for use as a single point login for my site, with the objective of not letting anyone into my entire site without the correct credentials/authorization. I want to permit access only to user groups 2,5,6,or 7 (registered users, moderators, and admins).

www.mysite.com
www.mysite.com/forums

A page with Bill's script code sits at the root (index.php) and my forum is under /forums. If a non-authorized user comes along I want to bounce him/her back to the ROOT with a message.

First I set the permissions of the usergroups to what I think they should be to stop them from getting nto my site at all, then I also use the following alteration of Bill's code on the root index page:

Code:
if($isAdmin){
	//show welcome message
	//show logout link
	//show link to forum
}elseif($isAuthorized){
	//javascript that sends authorized user to the forum homepage /forums
	echo "
	<script>	
		document.onload = redir();	
		function redir(){
			window.location.replace(\"forums\");	
		}
	</script>
	";
}else{
	//USER IS NOT AUTHORIZED
	//show a specific message regarding why they do not have access
	//show login boxes
	//show registration request link ONLY if user is usergroup 1 (Unregistered / Not Logged In)
}
The complication arises when I set the permissions of the usergroups of the unauthorized users. I dont want them to see ANYTHING. However, if I set the permissions of these users so that Usergroup Manager>>Forum Viewing Permissions>>Can View Forum == NO, the basic VBulletin authentication stops working correctly and I get a ghostlike home index page that appears like a screwed up version of the forum index page (see 1st attached snapshot). Also, logout stops working (see second attached snapshot).

If I change the permissions and allow my defined set of unauthorized usergroups access to view forums the problem goes away. However, this defeats my goal in preventing these unauthorized users from seeing the forum in the first place and by typing in /forum they can view the forum homepage!

Can anyone can shed light on this and help me achieve what I would like to do?

Thanks!

Jonathan
Reply With Quote
  #61  
Old 03-09-2007, 04:18 PM
abenoking abenoking is offline
 
Join Date: Sep 2006
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Skeezster View Post
Found the problem - it doesn't like being inside a function. Think I'm sorted now!
Just thought I would emphasize this, as I missed it the first time, and it hung me up for a couple of days. You cannot call the form or require inside a function.

Any chance for a fix on this though? It would make templating much easier.
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 11:46 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.04842 seconds
  • Memory Usage 2,345KB
  • 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
  • (2)bbcode_php
  • (6)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