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
  #32  
Old 12-12-2008, 04:48 PM
Submerge Submerge is offline
 
Join Date: Jan 2006
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you!
Reply With Quote
  #33  
Old 12-19-2008, 08:39 AM
MadsK MadsK is offline
 
Join Date: Apr 2008
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've finally got the script working - almost.

I can log in alright - but it does not show that i am logged in on the frontpage - only the log in box.

I've checke my cookies path in the admincp and it is set to "/" - I've tried different browser and clearing my cookies etc. But nothing seems to work?

If it is to any help - im using wordpress.
Reply With Quote
  #34  
Old 12-20-2008, 09:41 PM
Jeffonfire Jeffonfire is offline
 
Join Date: Nov 2008
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In response of MadsK, this bug seems to happen to a lot of us. I would really like to get some help from the developer of the code or from anyone else to find a way to solve this problem. This login box is a really important part of my website and right now it's a pain in the a** not to be able tu use it
Reply With Quote
  #35  
Old 12-22-2008, 10:26 PM
MadsK MadsK is offline
 
Join Date: Apr 2008
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>
";

}
?>
Reply With Quote
  #36  
Old 12-26-2008, 12:38 AM
tirol07 tirol07 is offline
 
Join Date: Mar 2007
Location: Austria
Posts: 71
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Than you for this useful hack!

How can i include header and navbar template to this script?
Reply With Quote
  #37  
Old 12-26-2008, 06:02 PM
Jeffonfire Jeffonfire is offline
 
Join Date: Nov 2008
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

MadsK, any way to make your code work for those who aren't on Wordpress?
Reply With Quote
  #38  
Old 01-03-2009, 08:14 PM
MadsK MadsK is offline
 
Join Date: Apr 2008
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You could try to replace the $user_id with the vbulletin equilant. But i'm not sure which that is.
Reply With Quote
  #39  
Old 01-08-2009, 04:00 AM
daggz daggz is offline
 
Join Date: Aug 2008
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Okay - first off Props to the poster - this is a great little addon

Now if anyone is having issues with login.php here is the be all fix

put the .php file inside your /forums directory

this will solve most issues as you are using vbulletin functionality from outside it's operating path - and is where you are most likely running into issues

For example prior I had a php page at mydomain/LINKS - the index.php was the link checker. When adding this hack in that /LINKS dir I was having issue (and I am not a code noob) - however the moment I put the php in my /forums directory and replaced my index.php on /LINKS with a frame loading the php from it's new location - everything works fine

Any just a bitta info - oh and always - perfect syntax people

Peace

.*
Reply With Quote
  #40  
Old 01-09-2009, 02:11 AM
Jeffonfire Jeffonfire is offline
 
Join Date: Nov 2008
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nope it doesn't work.

I put the .php that contains the login form in my forum folder, still shows as if i'm logged out.
Reply With Quote
  #41  
Old 02-20-2009, 03:15 AM
cowmoo cowmoo is offline
 
Join Date: Jul 2007
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, I've been trying to get this working for a fair while now, I'm getting the same problem as a lot of people here, the script continues to show the login form after logging in.

I'm running Ubuntu and FF3, it shows logged out, however running under IE6 (using wine) it worked correctly the first time only (would work again even clearing cookies, history, re-opening browser etc).
I noticed when it did work it sent back a session string as a _GET variable, but I couldn't get it to do that more than once without resetting my cookies etc.

Still gonna work on it some more, but thought I'd share what I've found so far.

cOwMoO
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 01:04 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.05008 seconds
  • Memory Usage 2,316KB
  • Queries Executed 27 (?)
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
  • (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
  • (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_postinfo_query
  • fetch_postinfo
  • 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