Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Beta Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Password protect non vb pages (e.g. for admin pages) Details »»
Password protect non vb pages (e.g. for admin pages)
Version: 1.00, by Rafe Rafe is offline
Developer Last Online: Mar 2011 Show Printable Version Email this Page

Version: 3.0.0 Rating:
Released: 05-08-2004 Last Update: Never Installs: 24
Is in Beta Stage  
No support by the author.

This is not really a hack just a handy piece of code. You can use this to password protect individual pages. The username and passwords are taken from the vBulletin database.

Currently this is set to allow only usergroupsid 5 and 6 (admin and super moderators) through [example use as admin area protection]. This could be changed though to allow anyone through if registered, or for specific usergroups etc.

The code is in authvb.php
An example is give in authtest.php

Hope this is of use to some people. If there's some interest I'll tidy it up a bit.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 05-26-2004, 12:00 AM
Oldfart Oldfart is offline
 
Join Date: Jun 2002
Posts: 66
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok I am trying this hack on my site but I seem to be getting a Sql error. The password logon comes up on the screen but when you hit the ok button after putting your logins in I get this Sql error message.

Warning: mysql_connect(): Unknown MySQL Server Host 'u' (1) in /home/xxxxxx/public_html/vwar/includes/classes/class_db.php on line 95

-> Database Error: Link-ID == false, connect failed
-> MySQL Error:
-> MySQL Error Number: 0
-> Date: 25.05.2004 @ 20:56
-> Script: /vwar/war.php
-> Referer:

Any help would be appreciated.

Are we supposed to run any Sql querries installing this?

if (isset( $PHP_AUTH_USER ) && isset($PHP_AUTH_PW)) {
mysql_connect( $checkservername, $dbcheckusername, $dbcheckpassword )
or die ( 'Unable to connect to server.' );
mysql_select_db( $dbcheckbase )
or die ( 'Unable to select database.' );
Reply With Quote
  #13  
Old 05-26-2004, 12:56 AM
maximux1's Avatar
maximux1 maximux1 is offline
 
Join Date: Mar 2002
Posts: 89
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Oldfart
Ok I am trying this hack on my site but I seem to be getting a Sql error. The password logon comes up on the screen but when you hit the ok button after putting your logins in I get this Sql error message.

Warning: mysql_connect(): Unknown MySQL Server Host 'u' (1) in /home/xxxxxx/public_html/vwar/includes/classes/class_db.php on line 95

-> Database Error: Link-ID == false, connect failed
-> MySQL Error:
-> MySQL Error Number: 0
-> Date: 25.05.2004 @ 20:56
-> Script: /vwar/war.php
-> Referer:

Any help would be appreciated.

Are we supposed to run any Sql querries installing this? It looks like you have the server set to "u" when more likely you want to set it to localhost.

if (isset( $PHP_AUTH_USER ) && isset($PHP_AUTH_PW)) {
mysql_connect( $checkservername, $dbcheckusername, $dbcheckpassword )
or die ( 'Unable to connect to server.' );
mysql_select_db( $dbcheckbase )
or die ( 'Unable to select database.' );
Whats the hostname of your mySQL server? Looks like it is currently set to "u" when you more likely want this to be "localhost".
Reply With Quote
  #14  
Old 05-26-2004, 01:27 AM
Oldfart Oldfart is offline
 
Join Date: Jun 2002
Posts: 66
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

My db is set to "localhost"

I have no idea why this happens. I must be doing something wrong.

I put my db settings in the authvb.php and put the require('./authvb.php');
in the page I want to secure but whenever I try and access that page I keep getting the same MySql error.
Reply With Quote
  #15  
Old 05-26-2004, 06:03 PM
Oldfart Oldfart is offline
 
Join Date: Jun 2002
Posts: 66
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

anyone have any ideas... I would like to get this to work on my site. ANy help would be appreciated.
Reply With Quote
  #16  
Old 05-26-2004, 07:22 PM
Rafe Rafe is offline
 
Join Date: Jul 2003
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by evilTone
Code:
// Check whether user belongs to certain usergroup 5 for supermoderators 6 for admins

$sql = "SELECT * FROM user WHERE username = '$PHP_AUTH_USER' AND (usergroupid = '6' or usergroupid = '5') "; $result = mysql_query( $sql ) or die ( 'Unable to execute query.' ); $num = mysql_numrows( $result ); if ( $num != 0 ) { $auth = true;     }
anyone have a way to make this check for secondary groups like
(membergroupids = '5' or membergroupids ='16')

the above seems to work ONLY if the user is in 5 or 16 as their only secondary group, ie, if users secondary groups are = 5,11,13 then it fails
I'll look into this for the next version (sorry a bit busy right now), but I haven't forgotten this.
Reply With Quote
  #17  
Old 05-29-2004, 07:40 PM
TheRayden TheRayden is offline
 
Join Date: Apr 2004
Location: Belgium
Posts: 38
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Installed it, but I can't even access the page I protected. I've set to it allow 2 usergroups to enter, admins being one of them.

When i try to access the page, I get the username/password popup, but it doesn't reconise me.
Reply With Quote
  #18  
Old 05-29-2004, 11:05 PM
ogetbilo ogetbilo is offline
 
Join Date: Mar 2004
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

what advantage does this hack have over an .htaccess password?
Reply With Quote
  #19  
Old 07-23-2004, 03:05 PM
xeonkiller711 xeonkiller711 is offline
 
Join Date: May 2004
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Make sure on the authtest.php you change the authvb3 to authvb.php just in case you guys didnt change that. Thats the only thing I saw wrong with the hack Thanks for the hack!
Reply With Quote
  #20  
Old 08-13-2004, 11:14 AM
misterfade misterfade is offline
 
Join Date: Jun 2003
Location: MTL
Posts: 64
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I can't believe how easy this hack looks! I just installed it and it looks fantastic. I did add a few extra usergroups (for my purposes), so it would be like this:

Code:
usergroupid = '2' or usergroupid = '5' or usergroupid = '6' or usergroupid = '7'
Just in case anyone wanted to know how to add extra usergroups.

*clicks install
Reply With Quote
  #21  
Old 08-15-2004, 11:56 PM
Code Monkey's Avatar
Code Monkey Code Monkey is offline
 
Join Date: May 2004
Posts: 1,080
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you have a newer version of PHP which disables global var tracking (a good thing) then replace $PHP_AUTH_USER with $_SERVER['PHP_AUTH_USER'] and $PHP_AUTH_PW with $_SERVER['PHP_AUTH_PW'] and you should be good to go.
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 03:11 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.04553 seconds
  • Memory Usage 2,307KB
  • 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
  • (2)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