Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives

Reply
 
Thread Tools
Details »»

Version: , by odell (Guest)
Developer Last Online: Jan 1970 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 05-03-2001 Last Update: Never Installs: 0
 
No support by the author.

It would be great if there were some hack to integrate vbulletin's user database with htaccess...

that would do the following things:[list=1][*]Vbulletin would seamlessly control htaccess as well as vbulletin user databases (for example.. u change password in vbulletin it also changes htaccess pass, or when u reg new user in vbulletin it would also create necessary htaccess user, etc..)[*]When users login with htaccess vbb automatically logs them in using the information that the user inputed for htaccess login[/list=1]

I just came across this script written for phpNuke that checks to see if a user logs in with htaccess and if they login with htaccess it will automatically log them in to phpNuke. I thought that much of this could be reused to work with vbulletin. Its only a portion of what would be required for a full htaccess integration hack but its a start anyway.

Im am just starting to learn php and dont have the necessary time or knowledge to create this hack but Im sure alot of ppl would benefit from it, and would all be very appreciateive if someone would create one.

Here is the source:

PHP Code:
<?PHP

/************************************************************************/
/*  Automatic recognition and connection of a user who connects to a    */
/*  PHPNuke site with a htaccess file.                                  */
/* ==================================================================== */
/*                                                                      */
/* Copyright (c) 2001 by Thomas Rudant (thomas.rudant@grunk.net)        */
/* [url]http://www.grunk.net[/url]                                                 */
/* [url]http://www.securite-internet.org[/url]                                     */
/*                                    */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/


if(!isset($mainfile)) { include("mainfile.php"); }

function 
docookie($setuid$setuname$setpass$setstorynum$setumode$setuorder$setthold$setnoscore$setublockon$settheme$setcommentmax) {
    
$info base64_encode("$setuid:$setuname:$setpass:$setstorynum:$setumode:$setuorder:$setthold:$setnoscore:$setublockon:$settheme:$setcommentmax");
    
setcookie("user","$info",time()+15552000);
    
    global 
$user;
    
$user=$info;
    
}

function 
login($uname$pass) {
    global 
$setinfo,$system;
    
dbconnect();
    
$result mysql_query("select pass, uid, storynum, umode, uorder, thold, noscore, ublockon, theme, commentmax from users where uname='$uname'");
    if(
mysql_num_rows($result)==1) {
        
$setinfo mysql_fetch_array($result);
        
$dbpass=$setinfo[pass];
        
        if(!
$system)
             
$pass=crypt($pass,substr($dbpass,0,2));

        if (
strcmp($dbpass,$pass)) {
                        
Header("Location: user.php?stop=1");
                        return;
                }

        
docookie($setinfo[uid], $uname$pass$setinfo[storynum], $setinfo[umode], $setinfo[uorder], $setinfo[thold], $setinfo[noscore], $setinfo[ublockon], $setinfo[theme], $setinfo[commentmax]);
    }
}

if (
$user)
{
    global 
$cookie;
    
    
cookiedecode($user);
    
$username $cookie[1];

    if (
$PHP_AUTH_USER!=$username)
    {
        
setcookie("user");
        
login ($PHP_AUTH_USER,$PHP_AUTH_PW);
    }
}
else
{
    
login ($PHP_AUTH_USER,$PHP_AUTH_PW);
}

?>

Show Your Support

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

Comments
  #12  
Old 07-07-2001, 06:58 PM
Ruth Ruth is offline
 
Join Date: Oct 2001
Posts: 171
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Polo

we are trying to manage the htaccess thru vB CP, so when everyone registers the login and pass are added automatically to the .htaccess (.htpasswd)

using that script has nothing to do with that, although they have the new SQL version but it is very expensive, and making a hack code for vB is much better with a better features

besides widexl.com support really sucks.
Reply With Quote
  #13  
Old 07-09-2001, 06:14 PM
roy7
Guest
 
Posts: n/a
Default

I haven't messed with .htpasswd files in ages, but it should be pretty simple to add new people to the file on the fly. But if a user changes their password that might be a pain. Unless you dump out the whole userbase fresh on every change?

There is also something like mod_auth_dbm, for dbm files instead of text files. That could make it trivial to both add and update the .htpasswd dbm file on every new user and changed password.

Would something ugly like writing out a .htpasswd from scratch every time work all right? Can you see if you have mod_auth_dbm support? (I think it comes with apache and might be turned on by default.)

-Jonathan
Reply With Quote
  #14  
Old 07-09-2001, 08:48 PM
The Prohacker's Avatar
The Prohacker The Prohacker is offline
 
Join Date: Oct 2001
Location: Dayton, Ohio
Posts: 55
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Using .htpasswd, could be very ineffeciant, so the best plan for it would be to use $PHP_AUTH_USER and $PHP_AUTH_PASS to get the username and password, then drop these varibles into a routine to see if they are a registered member, then if they are, and the password is correct, set a cookie to their system so they would be logged in.......

This check would have to added to everypage or would have to alter the getpermissions function in someway to check this....
Reply With Quote
  #15  
Old 07-13-2001, 11:25 PM
HairyMonster
Guest
 
Posts: n/a
Default

We actualy use this on our site to give members only access to hosted sites on our server.

From what I can gather it is pretty easy to install on the server and involves a mod to the httpd.conf file.

It gets passes directly from the SQL database and users can be removed from access by removing their accounts using the admin control panel.

We have been using it for a few weeks now and had no problems with it at all, users can even change pass as it does not write to a htaccess file it just accesses the database.

I will get my server admin Gaf to write a doc on it and post it up in the next few days.

I also know he has made it so we can give certain user groups access to certain sections of the site. Not a clue how but it works.

HM
Reply With Quote
  #16  
Old 08-04-2001, 11:51 PM
Martz's Avatar
Martz Martz is offline
 
Join Date: Oct 2001
Location: UK
Posts: 156
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try this link for another approach to this - most of work looks like its already done.
Reply With Quote
  #17  
Old 09-10-2001, 02:07 AM
fragbait fragbait is offline
 
Join Date: Mar 2002
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

bump
Reply With Quote
  #18  
Old 09-10-2001, 02:44 AM
fragbait fragbait is offline
 
Join Date: Mar 2002
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

has anybody figured this hack out yet?
Reply With Quote
  #19  
Old 09-10-2001, 12:03 PM
roy7
Guest
 
Posts: n/a
Default

I'm curious, what do you actually need it for?

-Jonathan
Reply With Quote
  #20  
Old 09-10-2001, 10:11 PM
fragbait fragbait is offline
 
Join Date: Mar 2002
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

well i have a games and anime site, and have tons of media to download. But i only want members to be able to download, so i was wondering if i could use the members already registered in my vbb....
Reply With Quote
  #21  
Old 09-11-2001, 09:46 AM
Cybergaf Cybergaf is offline
 
Join Date: Jan 2002
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

To HTACCESS protect pages for members only...

Install mod_auth_mysql on apache.

then for example in httpd.conf

<DIRECTORY /home/testdir>
AuthType Basic
AuthUserfile /dev/null
AuthName "Forum Member Access Only"
AuthType Basic
AuthGroupFile /dev/null
AuthMySQLHost localhost
AuthMySQLCryptedPasswords Off
AuthMySQLUser <user>
AuthMySQLPassword <pw>
AuthMySQLDB <forums dbase name>
AuthMySQLUserTable user
AuthMySQLNameField username
AuthMySQLPasswordField password
<Limit GET POST>
require valid-user
</limit>
</DIRECTORY>

just change user/pw to user/pw you use to access dbase and dbase name to whatever ya dbase is called and bobs ya uncle.

Or....

<DIRECTORY /home/testdir>
AuthType Basic
AuthUserfile /dev/null
AuthName "Member Access Only"
AuthType Basic
AuthGroupFile /dev/null
AuthMySQLHost localhost
AuthMySQLCryptedPasswords Off
AuthMySQLUser <user>
AuthMySQLPassword <pw>
AuthMySQLDB <forums dbase name>
AuthMySQLUserTable user
AuthMySQLNameField username
AuthMySQLPasswordField password
AuthMySQLGroupField usergroupid
<Limit GET POST>
require group 6 7
</limit>
</DIRECTORY>

The above example restricts to forum members who are 'admins & mods' a list of our group ids are..

# GROUP ID's
# 1 Unregistered / Not Logged In
# 2 Registered
# 3 Users Awaiting Email Confirmation
# 4 (COPPA) Users Awaiting Moderation
# 5 JNR Admin
# 6 Administrator
# 7 Moderators
# 8 Banned
# 9 Moderated
# 10 Gold Member
# 11 Platinum Member

You can see we have a few of ours added at the end, lol

Good luck
Reply With Quote
Reply

Thread Tools

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 04:52 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.10361 seconds
  • Memory Usage 2,318KB
  • 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_php
  • (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
  • (2)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
  • (7)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
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • postbit_imicons
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete