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

Category: Integration with vBulletin - Version: 3.7.0 RC 1 Rating:
Released: 03-20-2008 Last Update: Never Installs: 100
Re-useable Code Additional Files Translations  
No support by the author.

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 3.7 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.

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 don't 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.7 RC1


Change log

Version 2.00 (21st March 2008)
  • Initial vB 3.7.x release



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 03-30-2009, 12:40 PM
Digma Digma is offline
 
Join Date: Nov 2004
Location: Netherlands
Posts: 60
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

We've just start re-coding our main website and one of the things on our wishlist was to integrate the vb login sequence and have vb help determine what 'non-registered' users can or can't do. Easy to use, easy to install and works like a charm. It has also encouraged me to look further into this and see what else is possible. Excellent work and thank you for this simple but very effective mod. :up:
Reply With Quote
  #43  
Old 11-13-2009, 09:19 AM
Billspaintball's Avatar
Billspaintball Billspaintball is offline
 
Join Date: Sep 2003
Location: Bathurst, Au
Posts: 649
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just a brief heads up for anyone who is interested, initial testing shows that this works with vB4 beta 3
Reply With Quote
  #44  
Old 11-14-2009, 12:45 PM
aspen0 aspen0 is offline
 
Join Date: Apr 2003
Posts: 65
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks for that headsup Bill. I was about to come ask that. I've come to rely on this script a bit over the years (actually, an older version I think) and wanted to make sure it'd still work with the upgrade.
Reply With Quote
  #45  
Old 12-14-2009, 08:34 PM
AndyAA AndyAA is offline
 
Join Date: Dec 2009
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MadsK View Post
I found the trick to make it happen.

Below is the code i use for my site. It has been altered a little with some extra links after you've logged in but they can be changed. I've tested it with a couple of different friends on different computers, operating systems and browsers and it works on all of them.

With that said this is only working with Wordpress as it collects the cookie from the wordpress database and outputs it. When logging out it also clears both wordpress and vbulletin cookie!

I would really like some feedback on it

You can see it in action on my website http://www.swtorcommunity.com

Code:
<?php
// Version 2.00
// Released March 21st, 2008
// For vB 3.7.x
// Edit the line below to show path to your forums
$forumpath = "/forum/";


// You dont have to edit anything underneath here,
// but you can if you wish to style the login box
// to match the style of your site.

// ---------------
// COPYRIGHT STUFF
// ---------------
// You are free to use and modify this script in anyway you like.
// However,
// - Do not remove copyright notice
// - Dont pass it off as your own work.
// 
// This script is provided free of charges, however If you use this on a commercial
// venture a small paypal donation to cwp@cwp.id.au would be apprecieated.


// We check if user is logged in
		if (isset($user_ID)) {
			// User is logged in
			echo "<div id=loginwelcome>";
			$user_info = get_userdata($user_ID);
			echo $before_widget . $before_title . __("Welcome "). $user_info->display_name . $after_title;
			echo "</div>";
// If logged in display logout link
echo "<br />";

echo "<div id=loginmeta>";

echo "<a href=\"".$forumpath."usercp.php";
echo "\">";
echo "User CP</a>";

echo "<a href=\"".$forumpath."private.php";
echo "\">";
echo "Private Messages</a>";

echo "<a href=\"".$forumpath."search.php";
echo "\">";
echo "Search</a>";

echo "<a href=\"/wp-login.php?action=logout\">Logout</a>";

echo "</div>";

} else { // If user is not logged in, we do this stuff

// Display login boxes + button
// You can style this with html or CSS as normal if desired.
echo"
	<form id=loginform action=\"".$forumpath."login.php\" method=post onsubmit=md5hash(vb_login_password,vb_login_md5password,vb_login_md5password_utf)>
	<script type=text/javascript src=\"".$forumpath."clientscript/vbulletin_md5.js\"></script>
	
	<input name=vb_login_username value=Username id=user onFocus=this.value='' type=text id=navbar_username size=10 />
			
	<input name=vb_login_password type=password id=password size=10 value=Password onFocus=this.value='' />
	<br />
		
	<label id=rememberme for=cb_cookieuser_navbar>Remember Me?<input name=cookieuser type=checkbox id=cb_cookieuser_navbar value=1 checked=checked />
	</label>
	
		
	<input type=submit id=submit value=Login title=$vbphrase[enter_username_to_login_or_register] value=\"Log In\" />
		
	<input type=hidden name=s value=$session[sessionhash] />
	<input type=hidden name=do value=login />		
	<input type=hidden name=vb_login_md5password />
	<input type=hidden name=vb_login_md5password_utf />

	</form>
";

}
?>

You are a champion!!!!

I have been looking everywhere for a Wordpress login.

You made my day!


How can I display some user info ie: user photo/thread count/new messages like this mod:

https://vborg.vbsupport.ru/showthread.php?t=173698


Thanks again and hope you can help out

Andy
Reply With Quote
  #46  
Old 01-05-2010, 11:23 AM
archaosus archaosus is offline
 
Join Date: Oct 2006
Location: UK
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So a quick question regarding user authentication as I got this working really well now - at the moment it is checking for user ID "6" which is admin - non admins are moved to the site frontpage and information isnt loaded - however what I would like to do is have multiple usergroups able to access the page - ie 6,12,13 - would I then just change the code to

Code:
<?php
If ($vbulletin->userinfo['6,12,13']!=0)
or would I have to make nested id statements?
Reply With Quote
  #47  
Old 01-19-2010, 01:03 AM
Ipuck's Avatar
Ipuck Ipuck is offline
 
Join Date: Jun 2006
Location: California
Posts: 131
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Does any one know if I can use this mod on my site if the forums is in a subdomain? when I add: require_once('/path/to/your/forums/global.php'); the page goes blank.
Reply With Quote
  #48  
Old 01-19-2010, 01:21 AM
mandingo's Avatar
mandingo mandingo is offline
 
Join Date: Jun 2008
Posts: 307
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Ipuck View Post
Does any one know if I can use this mod on my site if the forums is in a subdomain? when I add: require_once('/path/to/your/forums/global.php'); the page goes blank.

/path/to/your/forums
needs to be the actual path to your forum root.
if you need:
Open up a text editor and paste this in it:
PHP Code:
<?
echo getcwd();
?>
and name the file
path.php
make sure it's path.php and not path.php.txt or anything like that.
Upload that file to your forum root and point your browser to it.
example:
http://yourforum.org/forum/path.php
should show you what you need to replace /path/to/your/forums with. delete that file when you're done with it.
Hope this helps.
Reply With Quote
  #49  
Old 01-19-2010, 01:31 AM
Ipuck's Avatar
Ipuck Ipuck is offline
 
Join Date: Jun 2006
Location: California
Posts: 131
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you for your quick response. I actually did add the path to the forum, but still doesnt work. This is what I got:

Quote:
<?php
$curdir = getcwd ();
chdir('/var/www/vhosts/mydomain.com/subdomains/mysubdomain/httpdocs/forum/');
require_once('global.php');
chdir ($curdir);
?>
It should work, but unfortunately it doesn't. I just don't understand why it doesn't work.

I also tried:

Quote:
<?php
$curdir = getcwd ();
chdir('/var/www/vhosts/mydomain.com/subdomains/mysubdomain/httpdocs/forum/');
require_once(''/var/www/vhosts/mydomain.com/subdomains/mysubdomain/httpdocs/forum/global.php');
chdir ($curdir);
?>
Reply With Quote
  #50  
Old 01-19-2010, 02:06 AM
mandingo's Avatar
mandingo mandingo is offline
 
Join Date: Jun 2008
Posts: 307
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Ipuck View Post
Thank you for your quick response. I actually did add the path to the forum, but still doesnt work. This is what I got:



It should work, but unfortunately it doesn't. I just don't understand why it doesn't work.

I also tried:
pm me the link to path.php on your server.
Reply With Quote
  #51  
Old 02-03-2010, 02:45 AM
metalguy639 metalguy639 is offline
 
Join Date: Dec 2008
Posts: 501
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Billspaintball View Post
Just a brief heads up for anyone who is interested, initial testing shows that this works with vB4 beta 3
Great but is there a fix for this cookies problem that everyone is having. I used this hack before and never had it do this before so it must be something to do with vb 3.8.4.
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 10:59 AM.


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.08533 seconds
  • Memory Usage 2,324KB
  • 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
  • (2)bbcode_code
  • (1)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
  • (3)pagenav_pagelink
  • (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