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
  #122  
Old 04-24-2007, 03:00 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 gbaker View Post
1. I tried to see if this was posted before, but was unable to find. Everything works great, but when "Log Out" is clicked, the "cleared cookies" vb page is shown and stays. Is this the normal behavior? Is there a known workaround to get it to return the initiating page? (other than hacking the vb code).
Thats the default vB behaviour.
As you guessed the way around that is to hack the vB code.
Quote:
2. On the subdomain issue, I have the typical: xxx.org and forums.xxx.org. By doing a "cwd()" in both the domain and subdomain, I confirmed that the physical locations are both under the main domain. However, the require_once of the global.php simply prohibits the page from displaying. Bypassing this with a technologically-superior "//" (commenting out), the page loads fine but displays the following after clicking login:
There is an additional method to bypass this issue now listed at the end of section 4 in the troubleshooting guide that may solve this for you https://vborg.vbsupport.ru/showpost....79&postcount=2
Reply With Quote
  #123  
Old 05-04-2007, 06:50 PM
revolink24 revolink24 is offline
 
Join Date: Jun 2006
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Warning: chdir(): No such file or directory (errno 2) in xxxxxx/xxxx/index49.php on line 59

Warning: main(/forums/global.php): failed to open stream: No such file or directory in xxx/xxx/xxx//index49.php on line 60

Fatal error: main(): Failed opening required '/forums/global.php' (include_path='.:/usr/local/lib/php') in /xxx/xxx/xxx/xxx/index49.php on line 60
Reply With Quote
  #124  
Old 05-07-2007, 12:54 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 revolink24 View Post
Warning: chdir(): No such file or directory (errno 2) .......

See step two in the troubleshooting guide.
https://vborg.vbsupport.ru/showpost....79&postcount=2

From those errors it appears that your path is entered wrong.
Reply With Quote
  #125  
Old 05-21-2007, 01:32 PM
ShadyB ShadyB is offline
 
Join Date: Dec 2006
Location: England
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have been trying to use this hack on my site, but I dont know where to place the code...
This is the code for my site, so please help me!

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
Designed by ShadyB!
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>ShadyB.co.uk | Members Area</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="../shadybauth.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="header">
	<div id="logo">
		<h1>Welcome to the members area </h1>
		<h2>SHADYB.CO.UK</h2>
	</div>
	<div id="menu">
      <ul>
        <li><a href="http://www.shadyb.co.uk/members/home.php" title="">Home</a></li>
        <li><a href="http://www.shadyb.co.uk/members/forum.php" title="">Forums</a></li>
        <li class="active"><a href="http://www.shadyb.co.uk/members/" title="">Members</a></li>
        <li><a href="http://www.shadyb.co.uk/members/downloads/" title="">Downloads</a></li>
        <li><a href="http://www.shadyb.co.uk/members/arcade/" title="">Arcade</a></li>
        <li><a href="http://www.shadyb.co.uk/members/servers.php" title="">Servers</a></li>
        <li><a href="#" title="">Server Sales </a></li>
      </ul>
  </div>
</div>
<div id="wrapper">
	<div id="content">
		<div id="sidebar">
			<div id="support">
				<h2>Status:</h2>
				<h3>
		  You are logged in! </div>
			<div id="login" class="boxed">
				<h2 class="title">Links</h2>
				<p class="title"><a href="userdetail.php">My Details</a><br />
				  My Files<br />
				  <a href="../chgpwd.php">Change Password </a><br />
	          </p>
				<div class="content"></div>
			</div>
			<div id="updates" class="boxed">
				<h2 class="title">Recent Updates</h2>
			  <div class="content">
				  <ul>
					  <li>
						  <h3>Updates</h3>
						  <p><a href="http://www.shadyb.co.uk/members/home.php">Update details are currently available on the home page! </a></p>
					  </li>
					  <li></li>
				  </ul>
			  </div>
			</div>
		</div>
		<div id="main">
			<div id="welcome" class="post">
				<h2 class="title">Welcome To The Members Area!</h2>
				<h3 class="date"><span class="month">Updated May 20th 2007 </span><span class="year"></span></h3>
				<div class="meta">
					<p>ShadyB<a href="#"></a></p>
				</div>
				<div class="story">
					<p><strong>Welcome to the ShadyB.co.uk members area. Here there will soon be private chat rooms, a music player, and games room, and a few more cool features! </strong><em></em></p>
				</div>
			</div>
			<div id="example" class="post">
				<h2 class="title">Information</h2>
				<h3 class="date"><span class="month">Updated May 20th 2007 </span><span class="year"></span></h3>
				<div class="meta">
					<p>ShadyB<a href="#"></a></p>
				</div>
				<div class="story">
					<p>This section will be expanded on soon!</p>
					<h3>Coming Soon! </h3>
					<p>Some features coming soon to the members area!</p>
					<ul>
					  <li>Private Games Room </li>
				      <li>Private Chat Rooms</li>
				      <li>Music Player</li>
				      <li>Some More Things When I Think Lol   <br /> 
		                 </li>
				  </ul>
			  </div>
			</div>
		</div>
	</div>
	<div style="clear: both;">&nbsp;</div>
</div>
<div id="footer">
	<p id="legal">Copyright &copy; 2007 ShadyB.co.uk </p>
</div>
</body>
</html>
Please could you say where I need to place the code to restrtct the whole page to a certain usergroup? Thankyou in advance!
Reply With Quote
  #126  
Old 05-21-2007, 01:43 PM
Mastar's Avatar
Mastar Mastar is offline
 
Join Date: Sep 2005
Posts: 680
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ShadyB View Post
I have been trying to use this hack on my site, but I dont know where to place the code...
This is the code for my site, so please help me!

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
Designed by ShadyB!
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>ShadyB.co.uk | Members Area</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="../shadybauth.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="header">
	<div id="logo">
		<h1>Welcome to the members area </h1>
		<h2>SHADYB.CO.UK</h2>
	</div>
	<div id="menu">
      <ul>
        <li><a href="http://www.shadyb.co.uk/members/home.php" title="">Home</a></li>
        <li><a href="http://www.shadyb.co.uk/members/forum.php" title="">Forums</a></li>
        <li class="active"><a href="http://www.shadyb.co.uk/members/" title="">Members</a></li>
        <li><a href="http://www.shadyb.co.uk/members/downloads/" title="">Downloads</a></li>
        <li><a href="http://www.shadyb.co.uk/members/arcade/" title="">Arcade</a></li>
        <li><a href="http://www.shadyb.co.uk/members/servers.php" title="">Servers</a></li>
        <li><a href="#" title="">Server Sales </a></li>
      </ul>
  </div>
</div>
<div id="wrapper">
	<div id="content">
		<div id="sidebar">
			<div id="support">
				<h2>Status:</h2>
				<h3>
		  You are logged in! </div>
			<div id="login" class="boxed">
				<h2 class="title">Links</h2>
				<p class="title"><a href="userdetail.php">My Details</a><br />
				  My Files<br />
				  <a href="../chgpwd.php">Change Password </a><br />
	          </p>
				<div class="content"></div>
			</div>
			<div id="updates" class="boxed">
				<h2 class="title">Recent Updates</h2>
			  <div class="content">
				  <ul>
					  <li>
						  <h3>Updates</h3>
						  <p><a href="http://www.shadyb.co.uk/members/home.php">Update details are currently available on the home page! </a></p>
					  </li>
					  <li></li>
				  </ul>
			  </div>
			</div>
		</div>
		<div id="main">
			<div id="welcome" class="post">
				<h2 class="title">Welcome To The Members Area!</h2>
				<h3 class="date"><span class="month">Updated May 20th 2007 </span><span class="year"></span></h3>
				<div class="meta">
					<p>ShadyB<a href="#"></a></p>
				</div>
				<div class="story">
					<p><strong>Welcome to the ShadyB.co.uk members area. Here there will soon be private chat rooms, a music player, and games room, and a few more cool features! </strong><em></em></p>
				</div>
			</div>
			<div id="example" class="post">
				<h2 class="title">Information</h2>
				<h3 class="date"><span class="month">Updated May 20th 2007 </span><span class="year"></span></h3>
				<div class="meta">
					<p>ShadyB<a href="#"></a></p>
				</div>
				<div class="story">
					<p>This section will be expanded on soon!</p>
					<h3>Coming Soon! </h3>
					<p>Some features coming soon to the members area!</p>
					<ul>
					  <li>Private Games Room </li>
				      <li>Private Chat Rooms</li>
				      <li>Music Player</li>
				      <li>Some More Things When I Think Lol   <br /> 
		                 </li>
				  </ul>
			  </div>
			</div>
		</div>
	</div>
	<div style="clear: both;">&nbsp;</div>
</div>
<div id="footer">
	<p id="legal">Copyright &copy; 2007 ShadyB.co.uk </p>
</div>
</body>
</html>
Please could you say where I need to place the code to restrtct the whole page to a certain usergroup? Thankyou in advance!


PHP Code:


<?php
$curdir 
getcwd ();
chdir('/path/to/your/forums');
require_once(
'/path/to/your/forums/global.php');
chdir ($curdir);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
Designed by ShadyB!
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>ShadyB.co.uk | Members Area</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="../shadybauth.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="header">
    <div id="logo">
        <h1>Welcome to the members area </h1>
        <h2>SHADYB.CO.UK</h2>
    </div>
    <div id="menu">
      <ul>
        <li><a href="http://www.shadyb.co.uk/members/home.php" title="">Home</a></li>
        <li><a href="http://www.shadyb.co.uk/members/forum.php" title="">Forums</a></li>
        <li class="active"><a href="http://www.shadyb.co.uk/members/" title="">Members</a></li>
        <li><a href="http://www.shadyb.co.uk/members/downloads/" title="">Downloads</a></li>
        <li><a href="http://www.shadyb.co.uk/members/arcade/" title="">Arcade</a></li>
        <li><a href="http://www.shadyb.co.uk/members/servers.php" title="">Servers</a></li>
        <li><a href="#" title="">Server Sales </a></li>
      </ul>
  </div>
</div>
<div id="wrapper">
    <div id="content">
        <div id="sidebar">
            <div id="support">
                <h2>Status:</h2>
                <h3>
          You are logged in!     
                      </h3>

                <p>
<!-- begin login code -->
<?php
   
require_once('/path/to/your/login_inc2.php');
?>          
<!-- end login code -->
          </p>
          
            </div>
            <div id="login" class="boxed">
                <h2 class="title">Links</h2>
                <p class="title"><a href="userdetail.php">My Details</a><br />
                  My Files<br />
                  <a href="../chgpwd.php">Change Password </a><br />
              </p>
                <div class="content"></div>
            </div>
            <div id="updates" class="boxed">
                <h2 class="title">Recent Updates</h2>
              <div class="content">
                  <ul>
                      <li>
                          <h3>Updates</h3>
                          <p><a href="http://www.shadyb.co.uk/members/home.php">Update details are currently available on the home page! </a></p>
                      </li>
                      <li></li>
                  </ul>
              </div>
            </div>
        </div>
        <div id="main">
            <div id="welcome" class="post">
                <h2 class="title">Welcome To The Members Area!</h2>
                <h3 class="date"><span class="month">Updated May 20th 2007 </span><span class="year"></span></h3>
                <div class="meta">
                    <p>ShadyB<a href="#"></a></p>
                </div>
                <div class="story">
                    <p><strong>Welcome to the ShadyB.co.uk members area. Here there will soon be private chat rooms, a music player, and games room, and a few more cool features! </strong><em></em></p>
                </div>
            </div>
            <div id="example" class="post">
                <h2 class="title">Information</h2>
                <h3 class="date"><span class="month">Updated May 20th 2007 </span><span class="year"></span></h3>
                <div class="meta">
                    <p>ShadyB<a href="#"></a></p>
                </div>
                <div class="story">
                    <p>This section will be expanded on soon!</p>
                    <h3>Coming Soon! </h3>
                    <p>Some features coming soon to the members area!</p>
                    <ul>
                      <li>Private Games Room </li>
                      <li>Private Chat Rooms</li>
                      <li>Music Player</li>
                      <li>Some More Things When I Think Lol   <br /> 
                         </li>
                  </ul>
              </div>
            </div>
        </div>
    </div>
    <div style="clear: both;">&nbsp;</div>
</div>
<div id="footer">
    <p id="legal">Copyright &copy; 2007 ShadyB.co.uk </p>
</div>
</body>
</html>

Fill in your info where there is RED.
Reply With Quote
  #127  
Old 05-21-2007, 01:54 PM
ShadyB ShadyB is offline
 
Join Date: Dec 2006
Location: England
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok I knew where to put that, but its the restricting bit I cant do...

PHP Code:
<?php
if ($vbulletin->userinfo['usergroupid'] == '6' )
    {
    echo 
"Have stuff for here";
             } else {
             echo 
"You do not have permission for this page"; }
    
?>
Its that bit that I dont know where to place.. I just keep getting parse errors if I try and do it...
I want it so that the page is viewable to people that are logged in, but not to people that arent..
Reply With Quote
  #128  
Old 05-21-2007, 04:09 PM
Mastar's Avatar
Mastar Mastar is offline
 
Join Date: Sep 2005
Posts: 680
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Why not create a vbulletin custom page :

https://vborg.vbsupport.ru/showthread.php?t=62164
Reply With Quote
  #129  
Old 05-21-2007, 04:15 PM
ShadyB ShadyB is offline
 
Join Date: Dec 2006
Location: England
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thats not what I'm trying to do... I have a different design for the site, and just want to use the login system, so users dont have to register on two different sites..
This hack does that, but I just dont know how to use the php code in my last post..
Reply With Quote
  #130  
Old 05-22-2007, 01:27 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 ShadyB View Post
Ok I knew where to put that, but its the restricting bit I cant do...

PHP Code:
<?php
if ($vbulletin->userinfo['usergroupid'] == '6' )
    {
    echo 
"Have stuff for here";
             } else {
             echo 
"You do not have permission for this page"; }
    
?>
Its that bit that I dont know where to place.. I just keep getting parse errors if I try and do it...
I want it so that the page is viewable to people that are logged in, but not to people that arent..
Your getting parse errors probably because your HTML code is not escaped correctly.

For example this bit here
Code:
<div id="welcome" class="post">
				<h2 class="title">Welcome To The Members Area!</h2>
				<h3 class="date"><span class="month">Updated May 20th 2007 </span><span class="year"></span></h3>
				<div class="meta">
					<p>ShadyB<a href="#"></a></p>
				</div>
should be done something like

Code:
<?php  
if ($vbulletin->userinfo['userid'] >0) { 
echo"

<div id=\"welcome\" class=\"post\">
				<h2 class=\"title\">Welcome To The Members Area!</h2>
				<h3 class=\"date\"><span class=\"month\">Updated May 20th 2007 </span><span class=\"year\"></span></h3>
				<div class=\"meta\">
					<p>ShadyB<a href=\"#\"></a></p>
				</div>

"; 
}  
?>
It does require some basic PHP skills to do this.
If you have not used PHP/HTML togeather before you really should do a couple of online tutorials on it.
Its a little confusing at first, but not hard to pick up the basics (which is all you need for this)
Reply With Quote
  #131  
Old 05-22-2007, 01:43 PM
ShadyB ShadyB is offline
 
Join Date: Dec 2006
Location: England
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thankyou SO MUCH BILL!!!
Adding the \'s in the right places made it work!!
I cannot thankyou enough.. I might make a donation =]
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 06: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.04815 seconds
  • Memory Usage 2,377KB
  • 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
  • (3)bbcode_php
  • (5)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